From: Duy Nguyen Date: Sun, 14 Jul 2013 03:59:37 GMT Subject: Re: [PATCH v2 10/19] documentation: add documentation of the index-v5 file format Message-ID: In-Reply-To: <1373650024-3001-11-git-send-email-t.gummerer@gmail.com> On Sat, Jul 13, 2013 at 12:26 AM, Thomas Gummerer wrote: > +== Directory offsets (diroffsets) > + > + diroffset (32-bits): offset to the directory relative to the beginning > + of the index file. There are ndir + 1 offsets in the diroffset table, > + the last is pointing to the end of the last direntry. With this last > + entry, we are able to replace the strlen of when reading the directory strlen of what? > + name, by calculating it from diroffset[n+1]-diroffset[n]-61. 61 is the > + size of the directory data, which follows each each directory + the > + crc sum + the NUL byte. > + > + This part is needed for making the directory entries bisectable and > + thus allowing a binary search. Just thinking out loud. Maybe this section and fileoffsets should be made optional extensions. So far I see no use for them. It's nice for a program to occasionally look at a single entry, but such programs do not exist (yet). For inotify monitor that may want to update a single file's stat, it could regenerate the index with {dir,file}offsets extensions the first time it attempts to update the index, then it could do bsearch. -- Duy