From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FzK4v-0004yh-2I for mharc-grub-devel@gnu.org; Sat, 08 Jul 2006 17:11:05 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FzK4t-0004ww-Lm for grub-devel@gnu.org; Sat, 08 Jul 2006 17:11:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FzK4q-0004rw-Qn for grub-devel@gnu.org; Sat, 08 Jul 2006 17:11:02 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FzK4q-0004ri-Lr for grub-devel@gnu.org; Sat, 08 Jul 2006 17:11:00 -0400 Received: from [212.85.152.101] (helo=kotoba.storever.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FzK5Z-0001Gf-2T for grub-devel@gnu.org; Sat, 08 Jul 2006 17:11:45 -0400 Received: from kotoba.oasis.nexedi.com (kotoba.oasis.nexedi.com [212.85.152.101]) by kotoba.storever.com (Postfix) with ESMTP id 8DDA53C9D65EE for ; Sun, 9 Jul 2006 01:02:12 +0200 (CEST) Received: from [??1] (localhost [127.0.0.1]) by kotoba.storever.com (Postfix) with ESMTP id 16BCF3C9D65EC for ; Sun, 9 Jul 2006 01:02:12 +0200 (CEST) From: "Yoshinori K. Okuji" Organization: enbug.org To: The development of GRUB 2 Date: Sat, 8 Jul 2006 23:10:56 +0200 User-Agent: KMail/1.8.2 References: <87wtarepr8.wl%jeroen@vrijschrift.org> <200607081807.44495.okuji@enbug.org> <87ac7jg7bb.wl%jeroen@vrijschrift.org> In-Reply-To: <87ac7jg7bb.wl%jeroen@vrijschrift.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200607082310.56584.okuji@enbug.org> X-Bogosity: No, tests=bogofilter, spamicity=0.383914, version=0.17.2 Subject: Re: [PATCH] Set size of partition correctly in grub_disk_open() 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: Sat, 08 Jul 2006 21:11:03 -0000 On Saturday 08 July 2006 22:39, Jeroen Dekkers wrote: > But it's a little bit illogical that the size you get from the same > disk structure isn't the size of the partition, but the size of > something else. It is not illogical from my point of view. The disk structure should describe the information on a disk but not on a partition. Your way looks illogical to me. > It's also not really useful: if you're opening a > partition, your are interested in the size of the partition most of > the time, not the size of the disk the partition is on. No. When you open something, you usually have no interest in the size. > The AFFS code > already assumes that the total_sectors is the size of the partition > and the blocklist code does that too, if you want to allow to read a > blocklist from a partition. blocklist does not. I fixed this bug some weeks ago. I don't remember about AFFS. I haven't proofread the code carefully. > Not having total_sectors the size of the partition also makes it > impossible to write generic code for both disks and > partitions. Everytime you want to get the size of a device, you've to > check whether the device is a disk or a partition. This will enlarge > the code unnecessary. Tell me why you need to know the size. The range check is automatically done by the disk interface, so you won't have to deal with such a check in the filesystem code. > So I don't really see why total_sectors should be the size of the disk > the partition is on instead of the size of the partition. Because the disk structure is for disks, and the partition structure is for partitions. Overwriting total_sectors in a disk means that you only lose information. If your concern is only the conditional that checks if a disk contains a partition or not, you can write a functional such as grub_device_get_size. Okuji