[parted-devel] [PATCH] Properly sync partitions with operating system

Petr Uzel petr.uzel at suse.cz
Fri Feb 20 12:21:57 UTC 2009


On Fri, Feb 20, 2009 at 01:01:03PM +0100, Joel Granados wrote:
> > merely queries the code for the appropriate partition table type
> > and always returns a non-negative number.
> 
> well.  The specific code in each label might return a negative number
> for error as well.   Think of some spec that defines that maximum number
> as something that might be read from disk (just playing the devils
> advocate here).  The read from disk might fail and then it must be able
> to tell the calling function that something when wrong.
> 
> > 
> > > when it encounters an error.  All possitive numbers can be valide to
> > > express max_number_of_supported_partitions.  Including 0. So a negative
> > > number would seem natural for me to use in this case.
> > >
> > >  0: means that the label does no support partitions.
> > >  <0: means the number of partitions
> > >  >0: means something nasty has ocurred.

AFAIK kernel has similar function that returns 1 if the device can not
be partitioned (maximum of one partition on a device does not make
sense anyway). So 0 could be used to indicate an error.

But this would be incosistent with the rest of functions that return
-1 in case of error and thus it might make things worse.

Just my two cents ;)

-- 
Best regards / s pozdravem

Petr Uzel, Packages maintainer
---------------------------------------------------------------------
SUSE LINUX, s.r.o.                          e-mail: puzel at suse.cz
Lihovarská 1060/12                          tel: +420 284 028 964
190 00 Prague 9                             fax: +420 284 028 951
Czech Republic                              http://www.suse.cz



More information about the parted-devel mailing list