VFSExplorerImpl.cpp revision a86d69394c2c8fa0fe3d22aa7e9cab4737454236
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * IVFSExplorer COM class implementations.
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * Copyright (C) 2009-2011 Oracle Corporation
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * This file is part of VirtualBox Open Source Edition (OSE), as
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * available from http://www.virtualbox.org. This file is free software;
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * you can redistribute it and/or modify it under the terms of the GNU
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * General Public License (GPL) as published by the Free Software
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * Foundation, in version 2 as it comes in the "COPYING" file of the
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence////////////////////////////////////////////////////////////////////////////////
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence// VFSExplorer definitions
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence////////////////////////////////////////////////////////////////////////////////
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence/* opaque private instance data of VFSExplorer class */
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence DirEntry(Utf8Str strName, VFSFileType_T fileType, uint64_t cbSize, uint32_t fMode)
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence * VFSExplorer COM initializer.
487e6abc16c1b2958d371b0d4e808953646b520aDavid LawrenceHRESULT VFSExplorer::init(VFSType_T aType, Utf8Str aFilePath, Utf8Str aHostname, Utf8Str aUsername, Utf8Str aPassword, VirtualBox *aVirtualBox)
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence /* Enclose the state transition NotReady->InInit->Ready */
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence /* Weak reference to a VirtualBox object */
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence /* initialize data */
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence m->strBucket = aFilePath.substr(1, bpos - 1); /* The bucket without any slashes */
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence aFilePath = aFilePath.substr(bpos); /* The rest of the file path */
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence /* Confirm a successful initialization */
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence * VFSExplorer COM uninitializer.
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence * Public method implementation.
487e6abc16c1b2958d371b0d4e808953646b520aDavid LawrenceSTDMETHODIMP VFSExplorer::COMGETTER(Path)(BSTR *aPath)
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence if (FAILED(autoCaller.rc())) return autoCaller.rc();
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
487e6abc16c1b2958d371b0d4e808953646b520aDavid LawrenceSTDMETHODIMP VFSExplorer::COMGETTER(Type)(VFSType_T *aType)
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence if (FAILED(autoCaller.rc())) return autoCaller.rc();
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence TaskVFSExplorer(TaskType aTaskType, VFSExplorer *aThat, Progress *aProgress)
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence static int taskThread(RTTHREAD aThread, void *pvUser);
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence static int uploadProgress(unsigned uPercent, void *pvUser);
return VFSExplorer::setErrorStatic(E_FAIL, Utf8StrFmt("Could not create taskThreadVFS (%Rrc)\n", vrc));
return vrc;
#ifdef VBOX_WITH_S3
#ifdef VBOX_WITH_S3
return VINF_SUCCESS;
if (pTask &&
if (fCanceled)
return VINF_SUCCESS;
t = VFSFileType_File;
t = VFSFileType_SymLink;
t = VFSFileType_Fifo;
t = VFSFileType_DevChar;
t = VFSFileType_DevBlock;
t = VFSFileType_Socket;
t = VFSFileType_WhiteOut;
fileList.push_back(VFSExplorer::Data::DirEntry(name, RTToVFSFileType(entry.Info.Attr.fMode), entry.Info.cbObject, entry.Info.Attr.fMode & (RTFS_UNIX_IRWXU | RTFS_UNIX_IRWXG | RTFS_UNIX_IRWXO)));
if (pszPath)
if (pDir)
return VINF_SUCCESS;
size_t i = 0;
++it, ++i)
return VINF_SUCCESS;
#ifdef VBOX_WITH_S3
int vrc = RTS3Create(&hS3, m->strUsername.c_str(), m->strPassword.c_str(), m->strHostname.c_str(), "virtualbox-agent/"VBOX_VERSION_STRING);
while (pBuckets)
fileList.push_back(VFSExplorer::Data::DirEntry(pBuckets->pszName, VFSFileType_Directory, 0, RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR));
while (pKeys)
fileList.push_back(VFSExplorer::Data::DirEntry(pKeys->pszName, VFSFileType_File, pKeys->cbFile, RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR));
return VINF_SUCCESS;
int vrc = RTS3Create(&hS3, m->strUsername.c_str(), m->strPassword.c_str(), m->strHostname.c_str(), "virtualbox-agent/"VBOX_VERSION_STRING);
size_t i = 0;
++it, ++i)
return VINF_SUCCESS;
static_cast<IVFSExplorer*>(this),
return rc;
STDMETHODIMP VFSExplorer::EntryList(ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(VFSFileType_T, aTypes), ComSafeArrayOut(LONG64, aSizes), ComSafeArrayOut(ULONG, aModes))
return E_POINTER;
size_t i = 0;
++it, ++i)
return S_OK;
++it)
return S_OK;
return rc;