fix used_block error
WIP: Adjust indentation in btrfsclone.c
WIP: add empty lines in tests's output
Prepare the code to handle a new image version

Simply rename some #define to make them more uniform.
Validate the image version to be restored

Give up if the version is not recognized.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Add functions to allocate and initialize the bitmap

This make the code a little bit easier to read and maintain.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Declare readbitmap() and initial_image_hdr() in one place

This reduce code duplication and simplify the development of format 0002.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Disable struct's members alignment and regroup the structs' definitions

The compiler automatically align the struct's members on the platform's
memory boundary. This is to prevent a lost of performance when the members
cross the memory boundary of the platform. If the alignment is not disabled,
the image created with a 64 bits version is not usable by a 32 bits version
and vice-versa.

In our case, a padding of 2 bytes is added before block_size to align it
on the next address divisible by 4.

    00000000  70 61 72 74 63 6c 6f 6e  65 2d 69 6d 61 67 65 45  |partclone-imageE|
    00000010  58 54 46 53 00 00 00 00  00 00 00 00 00 00 30 30  |XTFS..........00|
    00000020  30 31 XX XX 00-04-00-00  00-d0-ff-1f-00-00-00-00  |01..............|
    00000030  f4-ff-07-00-00-00-00-00  be-c3-01-00-00-00-00-00  |................|
    00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Move bitmap writing in write_image_bitmap()

This change simplify the implementation of image 0002.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Extract file system's infos from image_head and move them in fs_info

This commit impacts a lot of code, but it mostly consist of replacing one
type by another. Some functions are renamed to make them more logical given
the change.

This is an intermediate step. Some functions must access image_head and
fs_info because the values are not totally separated, but it will be fixed
in a later commit. For now the code is still purely version 0001.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>