Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1IFTFw-0006gs-QU for mharc-grub-devel@gnu.org; Mon, 30 Jul 2007 07:17:44 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IFTFu-0006gf-J4 for grub-devel@gnu.org; Mon, 30 Jul 2007 07:17:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IFTFt-0006gK-6k for grub-devel@gnu.org; Mon, 30 Jul 2007 07:17:42 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IFTFs-0006g9-Up for grub-devel@gnu.org; Mon, 30 Jul 2007 07:17:40 -0400 Received: from smtp-vbr13.xs4all.nl ([194.109.24.33]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IFTFs-00008w-EJ for grub-devel@gnu.org; Mon, 30 Jul 2007 07:17:40 -0400 Received: from localhost.localdomain (249-174.surfsnel.dsl.internl.net [145.99.174.249]) by smtp-vbr13.xs4all.nl (8.13.8/8.13.8) with ESMTP id l6UBHccH006929 for ; Mon, 30 Jul 2007 13:17:38 +0200 (CEST) (envelope-from mgerards@xs4all.nl) From: Marco Gerards To: The development of GRUB 2 References: <20070612162639.GA10829@ws3.vdp.com> <87abtohbsg.fsf@xs4all.nl> <20070728164413.GA13941@ws3.vdp.com> <874pjnhrya.fsf@xs4all.nl> <20070730041655.GA2258@ws3.vdp.com> Mail-Copies-To: mgerards@xs4all.nl Date: Mon, 30 Jul 2007 13:19:32 +0200 In-Reply-To: <20070730041655.GA2258@ws3.vdp.com> (bean123ch@gmail.com's message of "Mon, 30 Jul 2007 12:16:55 +0800") Message-ID: <87myxegmuz.fsf@xs4all.nl> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-kernel: FreeBSD 4.6-4.9 Subject: Re: NTFS file system driver (update 3) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jul 2007 11:17:43 -0000 Bean writes: > 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. Oh right, I thought you were caching disk blocks. In this case it is sane. :-) >> 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. Can you pass it around inside one of the structs? I understand that passing it around as parameter is not really nice. The problem is that this might actually break other code, which I want to prevent. I hope you see this might become a serious problem? -- Marco