Re: [AVFS] patch for magic char inside filenames
Miklos Szeredi <[email protected]> Tue, 08 Mar 2005 16:03:14 +0100
| Newsgroups | gmane.comp.file-systems.avfs.user |
|---|---|
| Message-ID | <[email protected]> |
> I attached my new patch for supporting the magic char in filenames. The > code tries to find for each path segment the longest part which is a > existing file (no matter if real local or inside an archive). This way > even "test.tar.gz#utar#ugz#utar" works for a real file > "test.tar.gz#utar". The magic char is also allowed in virtual files. > The code works well for me but I only tested it with the shared > library. I don't know if there are problems with the code or preload > method. Shouldn't be. At a quick glance the patch looks OK. I'll read it more thoroughly and probably apply it to CVS. If I forget please bug me :) > In one of my first mails I mentioned the problem about the inode number > of /#avfsstat/cache which is zero. Inode numbers 0 and 1 are reserved > so it should be at least 2. > The inode is calculated in src/state.c:297 > > buf->ino = (int) stf + st_paramhash(sf->stent->param); > > But for /#avfsstat stf and the hash is zero so the inode is also zero. > Would it be okay to just add 2 to guarantee the minimum inode number? Adding 2 wouldn't guarantee anything (because of integer overflow). You have to do some trickier calculation like buf->ino = ((unsigned int) stf + st_paramhash(st->stent->param)) % (~0U - 1) + 2; Not too nice hash function, you can probably come up with a better one. > And another question about archive creation: The readme writes a few > words about it but creating a directory test.tar.gz#+ just creates the > directory and no archive (with my patch, without my patch the makedir > fails). Does this not work with the shared library? It used to work to create an archive with mkdir, but since then write support for tar has been removed (I don't remember the exact reason, but it was in the name of some big progress :). So your patch should do fine for now. If write support comes back we can think about it. Thanks for your work, Miklos ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click