Changeset 98340 in vbox for trunk/src/VBox/Main/src-all
- Timestamp:
- Jan 30, 2023 12:09:34 AM (23 months ago)
- Location:
- trunk/src/VBox/Main/src-all
- Files:
-
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-all/ConsoleSharedFolderImpl.cpp
r98048 r98340 27 27 28 28 #define LOG_GROUP LOG_GROUP_MAIN_SHAREDFOLDER 29 #include "SharedFolderImpl.h" 30 #if !defined(VBOX_COM_INPROC) 31 # include "VirtualBoxImpl.h" 32 # include "MachineImpl.h" 33 #endif 29 #include "ConsoleSharedFolderImpl.h" 34 30 #include "ConsoleImpl.h" 35 31 … … 41 37 42 38 ///////////////////////////////////////////////////////////////////////////// 43 // SharedFolder::Data structure44 ///////////////////////////////////////////////////////////////////////////// 45 46 struct SharedFolder::Data39 // ConsoleSharedFolder::Data structure 40 ///////////////////////////////////////////////////////////////////////////// 41 42 struct ConsoleSharedFolder::Data 47 43 { 48 44 Data() … … 62 58 ///////////////////////////////////////////////////////////////////////////// 63 59 64 SharedFolder::SharedFolder()60 ConsoleSharedFolder::ConsoleSharedFolder() 65 61 : mParent(NULL), 66 #if !defined(VBOX_COM_INPROC)67 mMachine(NULL),68 mVirtualBox(NULL)69 #else70 62 mConsole(NULL) 71 #endif72 63 { 73 64 m = new Data; 74 65 } 75 66 76 SharedFolder::~SharedFolder()67 ConsoleSharedFolder::~ConsoleSharedFolder() 77 68 { 78 69 delete m; … … 80 71 } 81 72 82 HRESULT SharedFolder::FinalConstruct()73 HRESULT ConsoleSharedFolder::FinalConstruct() 83 74 { 84 75 return BaseFinalConstruct(); 85 76 } 86 77 87 void SharedFolder::FinalRelease()78 void ConsoleSharedFolder::FinalRelease() 88 79 { 89 80 uninit(); … … 94 85 ///////////////////////////////////////////////////////////////////////////// 95 86 96 #if !defined(VBOX_COM_INPROC)97 87 /** 98 88 * Initializes the shared folder object. 99 89 * 100 * This variant initializes a machine instance that lives in the serveraddress space.101 * 102 * @param a Machine parent Machineobject90 * This variant initializes an instance that lives in the console address space. 91 * 92 * @param aConsole Console parent object 103 93 * @param aName logical name of the shared folder 104 94 * @param aHostPath full path to the shared folder on the host 105 95 * @param aWritable writable if true, readonly otherwise 106 * @param aAutoMount if auto mounted by guest true, false otherwise107 96 * @param aAutoMountPoint Where the guest should try auto mount it. 108 97 * @param fFailOnError Whether to fail with an error if the shared folder path is bad. … … 110 99 * @return COM result indicator 111 100 */ 112 HRESULT SharedFolder::init(Machine *aMachine,101 HRESULT ConsoleSharedFolder::init(Console *aConsole, 113 102 const Utf8Str &aName, 114 103 const Utf8Str &aHostPath, … … 122 111 AssertReturn(autoInitSpan.isOk(), E_FAIL); 123 112 124 unconst(m Machine) = aMachine;125 126 HRESULT hrc = i_protectedInit(a Machine, aName, aHostPath, aWritable, aAutoMount, aAutoMountPoint, fFailOnError);113 unconst(mConsole) = aConsole; 114 115 HRESULT hrc = i_protectedInit(aConsole, aName, aHostPath, aWritable, aAutoMount, aAutoMountPoint, fFailOnError); 127 116 128 117 /* Confirm a successful initialization when it's the case */ … … 134 123 135 124 /** 136 * Initializes the shared folder object given another object137 * (a kind of copy constructor). This object makes a private copy of data138 * of the original object passed as an argument.139 *140 * @param aMachine parent Machine object141 * @param aThat shared folder object to copy142 *143 * @return COM result indicator144 */145 HRESULT SharedFolder::initCopy(Machine *aMachine, SharedFolder *aThat)146 {147 ComAssertRet(aThat, E_INVALIDARG);148 149 /* Enclose the state transition NotReady->InInit->Ready */150 AutoInitSpan autoInitSpan(this);151 AssertReturn(autoInitSpan.isOk(), E_FAIL);152 153 unconst(mMachine) = aMachine;154 155 HRESULT hrc = i_protectedInit(aMachine,156 aThat->m->strName,157 aThat->m->strHostPath,158 aThat->m->fWritable,159 aThat->m->fAutoMount,160 aThat->m->strAutoMountPoint,161 false /* fFailOnError */ );162 163 /* Confirm a successful initialization when it's the case */164 if (SUCCEEDED(hrc))165 autoInitSpan.setSucceeded();166 167 return hrc;168 }169 170 # if 0171 172 /**173 * Initializes the shared folder object.174 *175 * This variant initializes a global instance that lives in the server address space. It is not presently used.176 *177 * @param aVirtualBox VirtualBox parent object178 * @param aName logical name of the shared folder179 * @param aHostPath full path to the shared folder on the host180 * @param aWritable writable if true, readonly otherwise181 * @param aAutoMountPoint Where the guest should try auto mount it.182 * @param fFailOnError Whether to fail with an error if the shared folder path is bad.183 *184 * @return COM result indicator185 */186 HRESULT SharedFolder::init(VirtualBox *aVirtualBox,187 const Utf8Str &aName,188 const Utf8Str &aHostPath,189 bool aWritable,190 bool aAutoMount,191 const Utf8Str &aAutoMountPoint192 bool fFailOnError)193 {194 /* Enclose the state transition NotReady->InInit->Ready */195 AutoInitSpan autoInitSpan(this);196 AssertReturn(autoInitSpan.isOk(), E_FAIL);197 198 unconst(mVirtualBox) = aVirtualBox;199 200 HRESULT hrc = protectedInit(aVirtualBox, aName, aHostPath, aWritable, aAutoMount, aAutoMountPoint, fFailOnError);201 202 /* Confirm a successful initialization when it's the case */203 if (SUCCEEDED(hrc))204 autoInitSpan.setSucceeded();205 206 return hrc;207 }208 209 # endif210 211 #else212 213 /**214 * Initializes the shared folder object.215 *216 * This variant initializes an instance that lives in the console address space.217 *218 * @param aConsole Console parent object219 * @param aName logical name of the shared folder220 * @param aHostPath full path to the shared folder on the host221 * @param aWritable writable if true, readonly otherwise222 * @param aAutoMountPoint Where the guest should try auto mount it.223 * @param fFailOnError Whether to fail with an error if the shared folder path is bad.224 *225 * @return COM result indicator226 */227 HRESULT SharedFolder::init(Console *aConsole,228 const Utf8Str &aName,229 const Utf8Str &aHostPath,230 bool aWritable,231 bool aAutoMount,232 const Utf8Str &aAutoMountPoint,233 bool fFailOnError)234 {235 /* Enclose the state transition NotReady->InInit->Ready */236 AutoInitSpan autoInitSpan(this);237 AssertReturn(autoInitSpan.isOk(), E_FAIL);238 239 unconst(mConsole) = aConsole;240 241 HRESULT hrc = i_protectedInit(aConsole, aName, aHostPath, aWritable, aAutoMount, aAutoMountPoint, fFailOnError);242 243 /* Confirm a successful initialization when it's the case */244 if (SUCCEEDED(hrc))245 autoInitSpan.setSucceeded();246 247 return hrc;248 }249 #endif250 251 /**252 125 * Shared initialization code. Called from the other constructors. 253 126 * … … 255 128 * Must be called from under the object's lock! 256 129 */ 257 HRESULT SharedFolder::i_protectedInit(VirtualBoxBase *aParent,130 HRESULT ConsoleSharedFolder::i_protectedInit(VirtualBoxBase *aParent, 258 131 const Utf8Str &aName, 259 132 const Utf8Str &aHostPath, … … 326 199 * Called either from FinalRelease() or by the parent when it gets destroyed. 327 200 */ 328 void SharedFolder::uninit()201 void ConsoleSharedFolder::uninit() 329 202 { 330 203 LogFlowThisFunc(("\n")); … … 336 209 337 210 unconst(mParent) = NULL; 338 339 #if !defined(VBOX_COM_INPROC)340 unconst(mMachine) = NULL;341 unconst(mVirtualBox) = NULL;342 #else343 211 unconst(mConsole) = NULL; 344 #endif345 212 } 346 213 347 214 // wrapped ISharedFolder properties 348 215 ///////////////////////////////////////////////////////////////////////////// 349 HRESULT SharedFolder::getName(com::Utf8Str &aName)216 HRESULT ConsoleSharedFolder::getName(com::Utf8Str &aName) 350 217 { 351 218 /* mName is constant during life time, no need to lock */ … … 354 221 } 355 222 356 HRESULT SharedFolder::getHostPath(com::Utf8Str &aHostPath)223 HRESULT ConsoleSharedFolder::getHostPath(com::Utf8Str &aHostPath) 357 224 { 358 225 /* mHostPath is constant during life time, no need to lock */ … … 361 228 } 362 229 363 HRESULT SharedFolder::getAccessible(BOOL *aAccessible)230 HRESULT ConsoleSharedFolder::getAccessible(BOOL *aAccessible) 364 231 { 365 232 /* mName and mHostPath are constant during life time, no need to lock */ … … 391 258 } 392 259 393 HRESULT SharedFolder::getWritable(BOOL *aWritable)260 HRESULT ConsoleSharedFolder::getWritable(BOOL *aWritable) 394 261 { 395 262 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 398 265 } 399 266 400 HRESULT SharedFolder::setWritable(BOOL aWritable)267 HRESULT ConsoleSharedFolder::setWritable(BOOL aWritable) 401 268 { 402 269 RT_NOREF(aWritable); … … 404 271 } 405 272 406 HRESULT SharedFolder::getAutoMount(BOOL *aAutoMount)273 HRESULT ConsoleSharedFolder::getAutoMount(BOOL *aAutoMount) 407 274 { 408 275 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 411 278 } 412 279 413 HRESULT SharedFolder::setAutoMount(BOOL aAutoMount)280 HRESULT ConsoleSharedFolder::setAutoMount(BOOL aAutoMount) 414 281 { 415 282 RT_NOREF(aAutoMount); … … 417 284 } 418 285 419 HRESULT SharedFolder::getAutoMountPoint(com::Utf8Str &aAutoMountPoint)286 HRESULT ConsoleSharedFolder::getAutoMountPoint(com::Utf8Str &aAutoMountPoint) 420 287 { 421 288 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 424 291 } 425 292 426 HRESULT SharedFolder::setAutoMountPoint(com::Utf8Str const &aAutoMountPoint)293 HRESULT ConsoleSharedFolder::setAutoMountPoint(com::Utf8Str const &aAutoMountPoint) 427 294 { 428 295 RT_NOREF(aAutoMountPoint); … … 430 297 } 431 298 432 HRESULT SharedFolder::getLastAccessError(com::Utf8Str &aLastAccessError)299 HRESULT ConsoleSharedFolder::getLastAccessError(com::Utf8Str &aLastAccessError) 433 300 { 434 301 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 438 305 439 306 440 const Utf8Str& SharedFolder::i_getName() const307 const Utf8Str& ConsoleSharedFolder::i_getName() const 441 308 { 442 309 return m->strName; 443 310 } 444 311 445 const Utf8Str& SharedFolder::i_getHostPath() const312 const Utf8Str& ConsoleSharedFolder::i_getHostPath() const 446 313 { 447 314 return m->strHostPath; 448 315 } 449 316 450 bool SharedFolder::i_isWritable() const317 bool ConsoleSharedFolder::i_isWritable() const 451 318 { 452 319 return m->fWritable; 453 320 } 454 321 455 bool SharedFolder::i_isAutoMounted() const322 bool ConsoleSharedFolder::i_isAutoMounted() const 456 323 { 457 324 return m->fAutoMount; 458 325 } 459 326 460 const Utf8Str & SharedFolder::i_getAutoMountPoint() const327 const Utf8Str &ConsoleSharedFolder::i_getAutoMountPoint() const 461 328 { 462 329 return m->strAutoMountPoint; -
trunk/src/VBox/Main/src-all/MachineSharedFolderImpl.cpp
r98048 r98340 27 27 28 28 #define LOG_GROUP LOG_GROUP_MAIN_SHAREDFOLDER 29 #include "SharedFolderImpl.h" 30 #if !defined(VBOX_COM_INPROC) 31 # include "VirtualBoxImpl.h" 32 # include "MachineImpl.h" 33 #endif 29 #include "MachineSharedFolderImpl.h" 30 #include "VirtualBoxImpl.h" 31 #include "MachineImpl.h" 34 32 #include "ConsoleImpl.h" 35 33 … … 64 62 SharedFolder::SharedFolder() 65 63 : mParent(NULL), 66 #if !defined(VBOX_COM_INPROC)67 64 mMachine(NULL), 68 65 mVirtualBox(NULL) 69 #else70 mConsole(NULL)71 #endif72 66 { 73 67 m = new Data; … … 94 88 ///////////////////////////////////////////////////////////////////////////// 95 89 96 #if !defined(VBOX_COM_INPROC)97 90 /** 98 91 * Initializes the shared folder object. … … 189 182 bool aWritable, 190 183 bool aAutoMount, 191 const Utf8Str &aAutoMountPoint 184 const Utf8Str &aAutoMountPoint, 192 185 bool fFailOnError) 193 186 { … … 208 201 209 202 # endif 210 211 #else212 213 /**214 * Initializes the shared folder object.215 *216 * This variant initializes an instance that lives in the console address space.217 *218 * @param aConsole Console parent object219 * @param aName logical name of the shared folder220 * @param aHostPath full path to the shared folder on the host221 * @param aWritable writable if true, readonly otherwise222 * @param aAutoMountPoint Where the guest should try auto mount it.223 * @param fFailOnError Whether to fail with an error if the shared folder path is bad.224 *225 * @return COM result indicator226 */227 HRESULT SharedFolder::init(Console *aConsole,228 const Utf8Str &aName,229 const Utf8Str &aHostPath,230 bool aWritable,231 bool aAutoMount,232 const Utf8Str &aAutoMountPoint,233 bool fFailOnError)234 {235 /* Enclose the state transition NotReady->InInit->Ready */236 AutoInitSpan autoInitSpan(this);237 AssertReturn(autoInitSpan.isOk(), E_FAIL);238 239 unconst(mConsole) = aConsole;240 241 HRESULT hrc = i_protectedInit(aConsole, aName, aHostPath, aWritable, aAutoMount, aAutoMountPoint, fFailOnError);242 243 /* Confirm a successful initialization when it's the case */244 if (SUCCEEDED(hrc))245 autoInitSpan.setSucceeded();246 247 return hrc;248 }249 #endif250 203 251 204 /** … … 336 289 337 290 unconst(mParent) = NULL; 338 339 #if !defined(VBOX_COM_INPROC)340 291 unconst(mMachine) = NULL; 341 292 unconst(mVirtualBox) = NULL; 342 #else343 unconst(mConsole) = NULL;344 #endif345 293 } 346 294
Note:
See TracChangeset
for help on using the changeset viewer.