From 9d37510d1d98cbc1c316fccadc690330fb27a19a Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Thu, 9 Jul 2015 14:57:01 +0200 Subject: [PATCH] vbox: shared folder read/write loop fix Stop trying to read or write if the backend function reports that 0 bytes have been read or written. Fixes #1563 --- repos/ports/ports/virtualbox.hash | 2 +- .../patches/sharedfolder_pagelist.patch | 48 ++++++++++--------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/repos/ports/ports/virtualbox.hash b/repos/ports/ports/virtualbox.hash index 3e38572fd8..fed433b21f 100644 --- a/repos/ports/ports/virtualbox.hash +++ b/repos/ports/ports/virtualbox.hash @@ -1 +1 @@ -1722a638eb0095d736afffa29431c9c4da8f1d9b +166105c79c2ebd0d8378af72bb4c392595c7bd67 diff --git a/repos/ports/src/virtualbox/patches/sharedfolder_pagelist.patch b/repos/ports/src/virtualbox/patches/sharedfolder_pagelist.patch index 3a65f17cfb..2bcc2834c1 100644 --- a/repos/ports/src/virtualbox/patches/sharedfolder_pagelist.patch +++ b/repos/ports/src/virtualbox/patches/sharedfolder_pagelist.patch @@ -1,7 +1,7 @@ sharedfolder_pagelist.patch diff --git a/src/app/virtualbox/src/VBox/HostServices/SharedFolders/service.cpp b/src/app/virtualbox/src/VBox/HostServices/SharedFolders/service.cpp -index 49a0006..499d541 100644 +index 49a0006..f9da046 100644 --- a/src/app/virtualbox/src/VBox/HostServices/SharedFolders/service.cpp +++ b/src/app/virtualbox/src/VBox/HostServices/SharedFolders/service.cpp @@ -549,6 +549,14 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32 @@ -13,24 +13,28 @@ index 49a0006..499d541 100644 + /* WORKAROUND start */ + uint32_t read = 0; + -+ while (paParms[3].u.uint32 && read < paParms[3].u.uint32) { ++ while (read < paParms[3].u.uint32) { + + /* Execute the function. */ if (pStatusLed) { -@@ -562,13 +570,25 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32 +@@ -562,13 +570,27 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32 if (RT_SUCCESS(rc)) { -+ read += count; +- /* Update parameters.*/ +- paParms[3].u.uint32 = count; ++ if (count == 0) { ++ /* Update parameters.*/ ++ paParms[3].u.uint32 = read; ++ break; ++ } ++ ++ read += count; + offset += count; + pBuffer += count; + count = paParms[3].u.uint32 - read; -+ - /* Update parameters.*/ -- paParms[3].u.uint32 = count; -+ //paParms[3].u.uint32 = count; } else { @@ -41,40 +45,41 @@ index 49a0006..499d541 100644 + + } /* WORKAROUND - End */ + -+ + } } break; -@@ -616,6 +636,16 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32 +@@ -616,6 +638,14 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32 } else { + + -+ + /* WORKAROUND start */ -+ uint32_t write = 0; -+ -+ while (paParms[3].u.uint32 && write < paParms[3].u.uint32) { ++ uint32_t written = 0; + ++ while (written < paParms[3].u.uint32) { + + /* Execute the function. */ if (pStatusLed) { -@@ -629,13 +659,25 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32 +@@ -629,13 +659,27 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32 if (RT_SUCCESS(rc)) { -+ write += count; +- /* Update parameters.*/ +- paParms[3].u.uint32 = count; ++ if (count == 0) { ++ /* Update parameters.*/ ++ paParms[3].u.uint32 = written; ++ break; ++ } ++ ++ written += count; + offset += count; + pBuffer += count; -+ count = paParms[3].u.uint32 - write; -+ - /* Update parameters.*/ -- paParms[3].u.uint32 = count; -+ //paParms[3].u.uint32 = count; ++ count = paParms[3].u.uint32 - written; } else { @@ -82,7 +87,6 @@ index 49a0006..499d541 100644 } + + -+ + } /* WORKAROUND - End */ + +