Re: Proposed (unfinished) ZIP module available on Bugzilla



On Tue, 2006-05-30 at 19:35 +0200, Christian Neumair wrote:
> Dear GnomeVFS development community,
> 
> as requested by Ken Ishii who needs a ZIP module, I'm publishing a
> prelimitary version of a GnomeVFS ZIP module in Bugzilla [1]. People who
> are interested in development should check out the bug report and help
> out :).
> 
> [1] http://bugzilla.gnome.org/show_bug.cgi?id=343419

It seems this uncompresses the file on open and then reads from that. I
think this is the right approach, but there are some tricks you could
use to make this nicer. What you do is create the uncompressed temp
files (in /tmp) and then unlink the file, keeping the file descriptor
around. This means the file is not visible in the filesystem, but the
data for it is kept around until the last fd referencing it is closed.
You store this fd in a cache, and then use dup() to get a new
independent file descriptor to the file in do_open(). 

When the app is closed the kernel will close all fds and deallocate the
filesystem space. So, doing things this way means you'll never leak
tempfiles.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a lounge-singing albino vampire hunter who knows the secret of the alien 
invasion. She's a virginal punk traffic cop with an MBA from Harvard. They 
fight crime! 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]