[libvirt] [PATCH 0/2] Couple of sparse streams improvements

News entry & one simple fix. Michal Privoznik (2): news: Document sparse streams virStream: Forbid negative seeks docs/news.xml | 10 ++++++++++ src/internal.h | 7 +++++++ src/rpc/virnetclientstream.c | 1 + src/util/virfdstream.c | 1 + 4 files changed, 19 insertions(+) -- 2.13.0

Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- docs/news.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 4cf14b0d5..52915ee2e 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -35,6 +35,16 @@ <libvirt> <release version="v3.4.0" date="unreleased"> <section title="New features"> + <change> + <summary> + Improved streams to efficiently transfer sparseness + </summary> + <description> + New extension to virStream was implemented so that + virStorageVolDownload and virStorageVolUpload can preserve file + sparseness. + </description> + </change> </section> <section title="Improvements"> <change> -- 2.13.0

Currently, we don't assign any meaning to that. Our current view on virStream is that it's merely a pipe. And pipes don't support seeking. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/internal.h | 7 +++++++ src/rpc/virnetclientstream.c | 1 + src/util/virfdstream.c | 1 + 3 files changed, 9 insertions(+) diff --git a/src/internal.h b/src/internal.h index 5a5a430a2..9e7ef553d 100644 --- a/src/internal.h +++ b/src/internal.h @@ -527,6 +527,13 @@ goto label; \ } \ } while (0) +# define virCheckPositiveArgReturn(argname, retval) \ + do { \ + if (argname <= 0) { \ + virReportInvalidPositiveArg(argname); \ + return retval; \ + } \ + } while (0) # define virCheckNonZeroArgGoto(argname, label) \ do { \ if (argname == 0) { \ diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c index 7b28d63db..a9bf271dc 100644 --- a/src/rpc/virnetclientstream.c +++ b/src/rpc/virnetclientstream.c @@ -367,6 +367,7 @@ virNetClientStreamSetHole(virNetClientStreamPtr st, unsigned int flags) { virCheckFlags(0, -1); + virCheckPositiveArgReturn(length, -1); /* Shouldn't happen, But it's better to safe than sorry. */ if (st->holeLength) { diff --git a/src/util/virfdstream.c b/src/util/virfdstream.c index 6870d8846..7ee58be13 100644 --- a/src/util/virfdstream.c +++ b/src/util/virfdstream.c @@ -950,6 +950,7 @@ virFDStreamSendHole(virStreamPtr st, int ret = -1; virCheckFlags(0, -1); + virCheckPositiveArgReturn(length, -1); virObjectLock(fdst); if (fdst->length) { -- 2.13.0

On Thu, May 18, 2017 at 08:53:34AM +0200, Michal Privoznik wrote:
News entry & one simple fix.
Michal Privoznik (2): news: Document sparse streams virStream: Forbid negative seeks
docs/news.xml | 10 ++++++++++ src/internal.h | 7 +++++++ src/rpc/virnetclientstream.c | 1 + src/util/virfdstream.c | 1 + 4 files changed, 19 insertions(+)
ACK series Jan
participants (2)
-
Ján Tomko
-
Michal Privoznik