bug-parted
[Top][All Lists]
Advanced

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

Re: Should we make sector_size and phys_sector_size of type "long long"


From: K.G.
Subject: Re: Should we make sector_size and phys_sector_size of type "long long" ?
Date: Fri, 11 Nov 2005 19:22:20 +0100

On Fri, 11 Nov 2005 18:55:33 +0100
Patrick Leslie Polzer <address@hidden> wrote:

> On Fri, 11 Nov 2005 17:28:54 +0100
> K.G. <"K.G." <address@hidden>> wrote:
> 
> > (PED_SECTOR_SIZE was and now PED_SECTOR_SIZE_DEFAULT
> > (which has a too long name ;) is of type long long, and
> > sector_size is intended to replace it, so...)
> Why is it 64 bit long?

Because you can multiply anything with it and obtain a 64
bits value, especially in the case of a 32 bits FS you can
multiply a sector count of 4000000000 from a uint32_t by
PED_SECTOR_SIZE_DEFAULT and the result won't overflow
(provided you store it in a large enough variable, or
divide it just after that with a large enough value, or
whatever). Whether or not some code makes use of that, i
don't know. But the safe and lazy solution is to make
sector_size a long long (or a PedSector, that's the same
thing). The less lazy solution is to check all the code.

Guillaume




reply via email to

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