grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Set size of partition correctly in grub_disk_open()


From: Yoshinori K. Okuji
Subject: Re: [PATCH] Set size of partition correctly in grub_disk_open()
Date: Sat, 8 Jul 2006 23:10:56 +0200
User-agent: KMail/1.8.2

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 




reply via email to

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