tests: use checksum to detect rev(1) consistency

Signed-off-by: Karel Zak <kzak@redhat.com>
tests: update fdisk mbr tests

Signed-off-by: Karel Zak <kzak@redhat.com>
tests: add fdisk BSD test

Signed-off-by: Karel Zak <kzak@redhat.com>
tests: add fdisk GPT test

Note that the test does not check on-disk data (by checksum)
because the current fdisk does not allow to modify automatically
generated partition and disk UUIDs.

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: add basic library files

Signed-off-by: Karel Zak <kzak@redhat.com>
fdisk: use debug stuff from libfdisk

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: add basic structs

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: add parttype code

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: add alignment code

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: add generic label code

Signed-off-by: Karel Zak <kzak@redhat.com>
fdisk: remove duplicate code (already in libfdisk)

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: add firstsector utils

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: add topology and geometry functions

 - rename __discovery_* to fdisk_discovery_*
 - rename fdisk_context_force_sector_size() to fdisk_override_sector_size()
 - rename fdisk_context_set_user_geometry() to fdisk_override_geometry()

 - remove non-default sector size warning

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: add fdisk_reset_alignment()

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: add probing function

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: add context functions

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: cleanup the rest of fdisks/utils.c stuff

 - remove obsolete code
 - move fdisk_{set,get}_partition_type() to label.c (this is label
   driver operation)

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: split label and label operations

 Changes:

 - fdisk_label is a private label driver struct
 - generic header of the fdisk_label points to fdisk_label_operations
 - the private fdisk_label stuff is always allocated for all drivers
   during fdisk_context initialization

 - context->labels[] contains pointers to all supported labels (drivers)
 - context->label is a pointer to the currently used label

 This change allows to:

 - store label specific global settings (e.g. dos compatible mode,
   display units, ...) independently on the current label

 - add label specific function to the API

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: add fdisk_new_context(), reuse context

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: kill dos_compatible_flag global variable

... move the variable to label private struct.

Signed-off-by: Karel Zak <kzak@redhat.com>