Commit Graph

14 Commits

Author SHA1 Message Date
Stefan Reiter
f93eb14256 return version via rust fn instead of header define
Otherwise the string gets included in the QEMU binary, not the library.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-11-25 08:27:29 +01:00
Stefan Reiter
2eb96573b8 include crate version and git rev in header file
...so we can get the library version a binary is currently running with.

Version information is retrieved from the build environment (set by
cargo/make) and appended using 'with_after_include' to appear within the
include guard.

The version string in current-api.h is inconsequential, so ignore it in
diff. This way we only have to re-commit that file whenever the *actual*
API changes, not the version.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>

modified to avoid spawning subcommands

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-11-11 15:22:35 +01:00
Stefan Reiter
c28f578e09 add state serializing and loading functions
For dirty-bitmap migration, QEMU also needs to move the static state of
the library to the target. proxmox_{import,export}_state provide a means
of accessing said data in a serialized fashion.

QEMU treats the state as some unknown quantity of bytes and the result
does not need to be human-readable, so we encode it with 'bincode',
which is based on serde.

Since the quantity is only known *after* serialization, we have to
allocate the buffer ourselves. This is handled by Box::leak-ing a Rust
allocated buffer and cleaning up via the explicit
proxmox_free_state_buf function.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-10-28 22:08:05 +01:00
Stefan Reiter
a9e0937c2d read_image_at: iterate until buffer is filled
QEMU will always assume EOF when less bytes than requested are returned
by a block drivers 'read' interface, so we need to fill the buffer up to
'size' if possible.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-07-22 20:28:19 +02:00
Dietmar Maurer
3edf5d1045 add compress and encrypt paramaters
This breaks binary API again!
2020-07-09 10:43:24 +02:00
Dietmar Maurer
ca590e8fb9 current-api.h: update to include changes from previous commit 2020-07-06 13:31:31 +02:00
Dietmar Maurer
3be7064120 current-api.h: update to include changes from previous commit 2020-07-06 12:26:31 +02:00
Dietmar Maurer
932df89793 add restore data reading API
For accessing existing backups in a VM.
2020-07-06 09:59:18 +02:00
Dietmar Maurer
3b024418cc write_data: return 0 for reused chunks 2020-07-02 10:34:10 +02:00
Dietmar Maurer
240b35a097 log abort error to stderr 2020-07-02 07:41:47 +02:00
Dietmar Maurer
26d3718833 current-api.h: update docs 2020-07-02 07:12:51 +02:00
Dietmar Maurer
18a32972e4 add_config: use Vec<u8> instead of DataPointer 2020-07-01 12:54:22 +02:00
Dietmar Maurer
3e5db190ca avoid extra worker thread and command channel 2020-07-01 10:29:15 +02:00
Wolfgang Bumiller
b6e17373fd add api check
commit the current generated proxmox-backup-qemu.h as
'current-api.h' and run `diff -up` between the two in build
steps, so any changes to the C api are caught at build time.

cbindgen seems to be using a BTreeMap for the data, so it
should always come out sorted, so this should be a
stable-enough check.

Link: https://github.com/eqrion/cbindgen/issues/12
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-29 13:14:46 +02:00