Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Changes | 2 ++
Virt.xs | 4 ++++
lib/Sys/Virt/StorageVol.pm | 30 ++++++++++++++++++++++++++----
3 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/Changes b/Changes
index 989b795..6c671c0 100644
--- a/Changes
+++ b/Changes
@@ -9,6 +9,8 @@ Revision history for perl module Sys::Virt
- Introduce Stream::recvHole() and Stream::sendHole()
- Introduce Stream::sparse_recv_all()
- Introduce Stream::sparse_send_all()
+ - Register VOL_DOWNLOAD_SPARSE_STREAM &
+ VOL_UPLOAD_SPARSE_STREAM constants
3.3.0 2017-05-08
diff --git a/Virt.xs b/Virt.xs
index fc282b8..663571c 100644
--- a/Virt.xs
+++ b/Virt.xs
@@ -9209,6 +9209,10 @@ BOOT:
REGISTER_CONSTANT(VIR_STORAGE_VOL_USE_ALLOCATION, USE_ALLOCATION);
REGISTER_CONSTANT(VIR_STORAGE_VOL_GET_PHYSICAL, GET_PHYSICAL);
+ REGISTER_CONSTANT(VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM,
VOL_DOWNLOAD_SPARSE_STREAM);
+
+ REGISTER_CONSTANT(VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM, VOL_UPLOAD_SPARSE_STREAM);
+
stash = gv_stashpv( "Sys::Virt::Secret", TRUE );
REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_NONE, USAGE_TYPE_NONE);
REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_VOLUME, USAGE_TYPE_VOLUME);
diff --git a/lib/Sys/Virt/StorageVol.pm b/lib/Sys/Virt/StorageVol.pm
index 42f10e8..82c3df2 100644
--- a/lib/Sys/Virt/StorageVol.pm
+++ b/lib/Sys/Virt/StorageVol.pm
@@ -141,17 +141,39 @@ Return the physical size in allocation
=back
-=item $vol->download($st, $offset, $length);
+=item $vol->download($st, $offset, $length, $flags=0);
Download data from C<$vol> using the stream C<$st>. If C<$offset>
and C<$length> are non-zero, then restrict data to the specified
-volume byte range.
+volume byte range. The C<$flags> accept the following values:
-=item $vol->upload($st, $offset, $length);
+=over 4
+
+=item Sys::Virt::StorageVol::VOL_DOWNLOAD_SPARSE_STREAM
+
+If this flag is is set in @flags effective transmission of holes
+is enabled. This assumes using the stream C<$st> with combination of
+C<sparse_recv_all> or C<recv($flags =
+VIR_STREAM_RECV_STOP_AT_HOLE)> for honouring holes sent by server.
+
+=back
+
+=item $vol->upload($st, $offset, $length, $flags=0);
Upload data to C<$vol> using the stream C<$st>. If C<$offset>
and C<$length> are non-zero, then restrict data to the specified
-volume byte range.
+volume byte range. The C<$flags> accept the following values:
+
+=over 4
+
+=item Sys::Virt::StorageVol::VOL_UPLOAD_SPARSE_STREAM
+
+If this is set in C<$flags> effective transmission of holes is
+enabled. This assumes using the stream C<$st> with combination of
+C<sparse_send_all> or C<send_hole> to preserve source file
+sparseness.
+
+=back
=back
--
2.13.0