diskdump: Fix handling of header version

Negative header version is an error.
Header version 0 should not be treated as an error, but the values
in the header should be ignored.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
diskdup: defer processing of ELF notes

Since some ELF notes are arch-specific, the architecture must be set
before they can be processed. OTOH arch initialization code may read
from the dump file, i.e. read_page() must work when calling set_arch().
Since diskdump_read_page() requires valid bitmap data, read_notes()
must not be called before read_bitmap().

To avoid the need to parse subheader data twice, save the offset and
length for later, but do not read anything until after initializing
the other bits. I'm using struct setup_data to keep the data in one
place.

References: issue 1
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Fix error reporting if kdump_ctx cannot be allocated

If ctx is NULL, it cannot be passed to set_error(). There would be no
way to get the error message anyway...

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Separate context initialization from file open

This allows to get the error string when opening a file. The old API
is left for compatibility (and for lazy library users who do not care
about verbose error reporting).

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
kdump_set_fd: stop on genuine errors

If a probe fails with an error code other than kdump_unsupported, it
means the file format is recognized, but something failed during
initialization. Probing another format is unlikely to succeed, but
it would clear the actual error message, making it harder to understand
what failed. Let's stop the search in that case and keep the error
message from the failed probe.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Improve error reporting of paged reads

The paged_cpin interface is suboptimal, as it only returns the number
of remaining bytes. While this makes it very easy to check if the
complete buffer was read (zero return value), it's impossible to
distinguish between a system error and EOF if the return value is
non-zero. As a consequence, EOF may be reported as "Success", which
is wrong and confusing.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>