[parted-devel] ped_partition_is_flag_available doesn't work on free partitions

Colin Watson cjwatson at ubuntu.com
Fri Jul 10 13:58:48 UTC 2009


I noticed today that ped_partition_is_flag_available doesn't work on
free "partitions" - it asserts if !ped_partition_is_active (part). This
is sort of inconvenient. In particular, and this is how I came across
it, it makes it impossible to ask the question "can I create a partition
in this free space and use it as an LVM physical volume?" without first
asking libparted to create a partition there, which is not necessarily a
desirable thing to do.

None of the disklabel implementors of partition_is_flag_available appear
to care about the partition at all right now, although I suppose some
future implementor might (I've heard rumours that some SPARC systems
don't seem to support LVM physical volumes right at the start of the
disk, for instance).

I can sort of understand why it was done this way: it means that if
ped_partition_is_flag_available returns true then you can definitely
call ped_partition_set_flag, without having to check first whether the
partition is free. I suppose there are probably partitioning frontends
that rely on this for correctness, too. Therefore perhaps it needs to be
a separate function.

Would it be possible to grow an interface that allows asking this
question about free space as well as ordinary partitions? It should just
need to call the same backend functions.

Thanks,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]



More information about the parted-devel mailing list