[haiku-development] Re: FAT fix, step 1 questions

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 19 Jan 2010 09:39:26 +0100

Romain <romain.haiku@xxxxxxxxxxx> wrote:
> >> - Where is used the cookie that is a parameter of each function ? 
> > > The 
> >> ext2
> >> filesystem sets it to NULL, and the FAT filesystem assigns it. The 
> >> answer
> >> to the previous question may also answer this one.
> >Not sure what you are referring to.
> >For example the open()/read()/write()/close() methods have a cookie 
> > if 
> >the file system needs to preserve any data between a file descriptor 
> >life cycle. Not all file systems need this, though, but those that 
> >support writing probably do.
> I was talking about the second parameter in file_cache_read for 
> example,
> but now I suppose that it is used to pass it to read_pages or io call 
> as
> their cookie parameter.

Exactly; the file cache implementation is in 
src/system/kernel/cache/file_cache.cpp and you can easily see how the 
cookie is being used there.

[...]
> >Don't drop the code. If you think you can clean it up, it's ok.
> I do not plan to rewrite the code. Originally I only proposed to fix 
> those
> bugs, but it was suggested to refactor it. I think that the existing 
> code
> can be modified a little bit to get a class design similar to the 
> ext2
> code. Typically I now have a fix for ticket 4602 (at least on one usb 
> stick
> I tried), and I will need to do few changes on the volume management. 
> This
> could be done by moving the volume code to a Volume class. Then I 
> could do
> something similar with other parts, but always with keeping the 
> existing
> code.
> However I can also keep everything as is, and just do the minimal 
> needed
> changes to do the fixes.

Refactoring would definitely be welcome. However, usually, one would 
try to separate bug fix patches from refactoring (which doesn't always 
work out, of course).

Bye,
   Axel.


Other related posts: