bug-parted
[Top][All Lists]
Advanced

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

Sorting out the new PedUnit API


From: Andrew Clausen
Subject: Sorting out the new PedUnit API
Date: Thu, 16 Jun 2005 22:36:21 +1000
User-agent: Mutt/1.5.6+20040907i

Hi all,

It would be nice to sort out the new PedUnit API.

Firstly, the latest survey results are:

        (raw data view)
        Q1: AADABABCCCDC
        Q2: DCEAABBDADAD
        Q3: CACAAABCADAC
        Q4: DDFCBECDEEAE

        (histogram view)
        Q1: AAAABBCCCCDD
        Q2: AAAABBCDDDDE
        Q3: AAAAAABCCCCD
        Q4: ABCCDDDEEEEF

I attached the annotated survey.

At the moment, the primary input functions' prototypes are:

int ped_unit_parse (const char* str, PedDevice* dev,PedSector* sector);
int ped_unit_parse_custom (const char* str, PedDevice* dev,
                           PedUnit unit, PedSector* sector);

If we want to make some units have special semantics, we could do this
by using constraints.  A rather general way of doing this would be
the following:

int ped_unit_parse (const char* str, PedDevice* dev, PedSector* sector,
                    PedGeometry** range);
int ped_unit_parse_custom (const char* str, PedDevice* dev,
                           PedUnit unit, PedSector* sector,
                           PedGeometry** range);

The idea is that ped_unit_parse() would return a range constraint (i.e.
a PedGeometry) that describes how flexible the user would like its input
to be treated.  For units like chs, we might want to return

        *range = ped_geometry_new(dev, *sector, 1);

For units like MB, we might want to make it a megabyte radius around
*sector.

In any case, I think this API is very flexible.  It should allow us to
change the semantics to anything we want without any binary
incompatibilities.  Any objections?

Cheers,
Andrew

Attachment: survey-annotate
Description: Text document


reply via email to

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