Petr Uzel <[email protected]> writes: > 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.
The other functions are either wrong to return "int" (if they always return non-negative) or have to handle failure indicated by returning a negative value. This is neither of those cases. It's essentially returning a per-partition-type non-negative constant. So it can safely return "unsigned int". _______________________________________________ parted-devel mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/parted-devel

