From: VMware, Inc <> Date: Mon, 26 Apr 2010 18:26:50 +0000 (-0700) Subject: Fix renames across volumes for HGFS Windows guests X-Git-Tag: 2010.04.25-253928~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2819f1fddc7d782cbdff074356d18e164a48d015;p=thirdparty%2Fopen-vm-tools.git Fix renames across volumes for HGFS Windows guests For non-Windows hosts, the HGFS server will not be able to handle cross volume renames returning the error HGFS_STATUS_GENERIC_ERROR. A new error should be returned and mapped to the Windows system status STATUS_NOT_SAME_DEVICE and EXDEV by the guest file system client. This will cause the application (Windows Explorer, Posix mv) to break the move file operation into a copy and delete file operations. Windows HGFS server does not currently return this error at all, and furthermore, handles the cross volume rename operations internally. However, since non-Windows hosts and guests both use the new HGFS_STATUS_NOT_SAME_VOLUME error for this rename error, the Windows server could be later modified to return this too for consistency and then all guest clients can let the guest application handle it accordingly. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/hgfs/hgfsUtil.c b/open-vm-tools/lib/hgfs/hgfsUtil.c index 56b2b3236..4ad5815e9 100644 --- a/open-vm-tools/lib/hgfs/hgfsUtil.c +++ b/open-vm-tools/lib/hgfs/hgfsUtil.c @@ -231,6 +231,8 @@ HgfsConvertFromInternalStatus(HgfsInternalStatus status) // IN return HGFS_STATUS_OPERATION_NOT_SUPPORTED; case ERROR_INVALID_PARAMETER: return HGFS_STATUS_INVALID_PARAMETER; + case ERROR_NOT_SAME_DEVICE: + return HGFS_STATUS_NOT_SAME_DEVICE; case HGFS_INTERNAL_STATUS_ERROR: default: return HGFS_STATUS_GENERIC_ERROR; @@ -272,6 +274,8 @@ HgfsConvertFromInternalStatus(HgfsInternalStatus status) // IN return HGFS_STATUS_NAME_TOO_LONG; case EPARAMETERNOTSUPPORTED: return HGFS_STATUS_INVALID_PARAMETER; + case EXDEV: + return HGFS_STATUS_NOT_SAME_DEVICE; case HGFS_INTERNAL_STATUS_ERROR: default: return HGFS_STATUS_GENERIC_ERROR; diff --git a/open-vm-tools/lib/include/hgfs.h b/open-vm-tools/lib/include/hgfs.h index b3d7b2346..ffa5e36de 100644 --- a/open-vm-tools/lib/include/hgfs.h +++ b/open-vm-tools/lib/include/hgfs.h @@ -169,6 +169,7 @@ typedef enum { HGFS_STATUS_OPERATION_NOT_SUPPORTED, HGFS_STATUS_NAME_TOO_LONG, HGFS_STATUS_INVALID_PARAMETER, + HGFS_STATUS_NOT_SAME_DEVICE, /* * Following error codes are for V4 and above protocol only. * Server must never retun these codes for legacy clients. diff --git a/open-vm-tools/modules/linux/vmhgfs/fsutil.c b/open-vm-tools/modules/linux/vmhgfs/fsutil.c index 4c0b9fdba..c9b01c833 100644 --- a/open-vm-tools/modules/linux/vmhgfs/fsutil.c +++ b/open-vm-tools/modules/linux/vmhgfs/fsutil.c @@ -1540,6 +1540,9 @@ HgfsStatusConvertToLinux(HgfsStatus hgfsStatus) // IN: Status code to convert case HGFS_STATUS_GENERIC_ERROR: return -EIO; + case HGFS_STATUS_NOT_SAME_DEVICE: + return -EXDEV; + default: LOG(10, (KERN_DEBUG "VMware hgfs: HgfsStatusConvertToLinux: unknown " "error: %u\n", hgfsStatus));