grub-devel
[Top][All Lists]
Advanced

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

Re: NTFS file system driver (update 3)


From: Bean
Subject: Re: NTFS file system driver (update 3)
Date: Mon, 30 Jul 2007 12:16:55 +0800
User-agent: Mutt/1.5.13 (2006-08-11)

On Sun, Jul 29, 2007 at 10:31:57PM +0200, Marco Gerards wrote:
> GRUB already has caching code, see kern/disk.c.  So this just can
> better be removed, to fix deallocation issues, etc.

The caching is mainly for decompression. In NTFS, the basic decompression unit
is 4096 bytes. If we don't cache the result, we may need to run the
decompression routine again.

> I still don't really get it ;-).  You wrote an NTFS implementation
> which is supposed to know about the disk layout of a file.  So why do
> you need a hook to peek how NTFS works?  This sounds a bit circular to
> me.
> 
> I am sure there is another and cleaner way to fix this.  This solution
> can not be used inside a filesystem implementation because it might
> break other code.  Can you please look for some other solution?

In fact, the hook comes from above.

In grub_ntfs_read:

  mft->read_hook=file->read_hook;


In read_data, the hook is enabled:

  ctx->comp.disk=at->mft->data->disk;

  ...

  ctx->comp.disk->read_hook=at->mft->read_hook;

  ...

  ctx->comp.disk->read_hook = 0;

In read_run_list, the hook is disabled temporarily:

   save_hook = ctx->comp.disk->read_hook;
   ctx->comp.disk->read_hook = 0;
   run = find_attr (ctx->attr, (unsigned char) *ctx->attr->attr_cur);
   ctx->comp.disk->read_hook = save_hook;

I could have used read_hook as a function parameter, but it seems a waste
of memory becasue it's accessed deep within the function calls.

-- 
Bean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]