Stops using partclone's head buffer to read the blocks

That buffer is not present in image format 0002.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Rewrite partclone's image_head as image_desc as a first step to support format 0002

This rewrite image_desc as three sub-struct to facilitate support for format 0002,
in which the fields are organised differently. Only the "head" struct has the same
size.

Also make the alignment padding explicit by disabling the packing done by
the compiler when defining partclone's structs.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Update the code to work with image_desc_v2

This change makes the support of both version sameless. Only the
initialization code have to deal with the difference between image_desc_v1
and image_desc_v2. The rest of the code always uses image_options_v2.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Extract some functions from v1_init() to make them available for futur v2_init()

The functions extracted are:
- init_crc32_table()
- init_omode()
- alloc_v1_context()

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Check the image's head validity when it is read

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Extract v1_read_bitmap() from v1_verify()

Also create read_bitmap_byte() to be reused with format 0002.

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Extract generate_usedblocks_map() from v1_verify()

Signed-off-by: Patryck Rouleau <pfrouleau@gmail.com>
Implement v2_init() to read image 0002 description

Also include definition of stubs for the other v2 functions. They will be
implemented in the following commits.

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