Changeset 75666 in vbox
- Timestamp:
- Nov 22, 2018 2:13:32 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 126860
- Location:
- trunk/src/VBox/Additions/darwin/VBoxSF
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/darwin/VBoxSF/Info.plist
r57063 r75666 4 4 <dict> 5 5 <key>CFBundleDevelopmentRegion</key> <string>English</string> 6 <key>CFBundleExecutable</key> <string>VBox VFS</string>6 <key>CFBundleExecutable</key> <string>VBoxSF</string> 7 7 <key>CFBundleIconFile</key> <string></string> 8 <key>CFBundleIdentifier</key> <string>org.virtualbox.kext.VBox VFS</string>8 <key>CFBundleIdentifier</key> <string>org.virtualbox.kext.VBoxSF</string> 9 9 <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> 10 <key>CFBundleName</key> <string>VBox VFS</string>10 <key>CFBundleName</key> <string>VBoxSF</string> 11 11 <key>CFBundlePackageType</key> <string>KEXT</string> 12 12 <key>CFBundleGetInfoString</key> <string>@VBOX_PRODUCT@ @VBOX_VERSION_STRING@, © 2007-@VBOX_C_YEAR@ @VBOX_VENDOR@</string> … … 17 17 18 18 <dict> 19 <key>VBox VFS</key>19 <key>VBoxSF</key> 20 20 <dict> 21 <key>IOMatchCategory</key> <string>org_virtualbox_VBox VFS</string>22 <key>IOClientClass</key> <string>VBox VFSClient</string>23 <key>IOClass</key> <string>org_virtualbox_VBox VFS</string>24 <key>CFBundleIdentifier</key> <string>org.virtualbox.kext.VBox VFS</string>21 <key>IOMatchCategory</key> <string>org_virtualbox_VBoxSF</string> 22 <key>IOClientClass</key> <string>VBoxSFClient</string> 23 <key>IOClass</key> <string>org_virtualbox_VBoxSF</string> 24 <key>CFBundleIdentifier</key> <string>org.virtualbox.kext.VBoxSF</string> 25 25 <key>IOKitDebug</key> <integer>65535</integer> 26 26 <key>IOProviderClass</key> <string>IOPCIDevice</string> … … 29 29 </dict> 30 30 31 <key>NSHumanReadableCopyright</key> <string>Copyright © 20 13Oracle Inc. All rights reserved.</string>31 <key>NSHumanReadableCopyright</key> <string>Copyright © 2007-@VBOX_C_YEAR@ Oracle Inc. All rights reserved.</string> 32 32 33 33 <key>OSBundleLibraries</key> -
trunk/src/VBox/Additions/darwin/VBoxSF/Makefile.kmk
r75293 r75666 46 46 $(PATH_SUB_CURRENT)/Info.plist \ 47 47 $(VBOX_VERSION_MK) | $$(dir $$@) 48 49 50 51 52 53 54 55 56 57 58 59 48 $(call MSG_GENERATE,VBoxSF,$@,$<) 49 $(QUIET)$(RM) -f $@ 50 $(QUIET)$(SED) \ 51 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \ 52 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \ 53 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \ 54 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \ 55 -e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \ 56 -e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \ 57 -e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \ 58 --output $@ \ 59 $< 60 60 61 61 # -
trunk/src/VBox/Additions/darwin/VBoxSF/VBoxSF-Utils.cpp
r75293 r75666 77 77 vnode_params.vnfs_dvp = pParent; 78 78 vnode_params.vnfs_fsnode = pVnodeData; /** Private data attached per xnu's vnode object */ 79 vnode_params.vnfs_vops = g_ VBoxVFSVnodeDirOpsVector;79 vnode_params.vnfs_vops = g_papfnVBoxVFSVnodeDirOpsVector; 80 80 81 81 vnode_params.vnfs_markroot = fIsRoot; … … 387 387 parms.CreateFlags = fFlags; 388 388 389 rc = VbglR0SfCreate(&g_ vboxSFClient, &pMount->pMap, pPath, &parms);389 rc = VbglR0SfCreate(&g_SfClient, &pMount->pMap, pPath, &parms); 390 390 if (RT_SUCCESS(rc)) 391 391 { … … 412 412 { 413 413 AssertReturn(pMount, EINVAL); 414 return VbglR0SfClose(&g_ vboxSFClient, &pMount->pMap, pHandle);414 return VbglR0SfClose(&g_SfClient, &pMount->pMap, pHandle); 415 415 } 416 416 … … 442 442 parms.CreateFlags = SHFL_CF_LOOKUP | SHFL_CF_ACT_FAIL_IF_NEW; 443 443 444 rc = VbglR0SfCreate(&g_ vboxSFClient, &pMount->pMap, pSHFLDPath, &parms);444 rc = VbglR0SfCreate(&g_SfClient, &pMount->pMap, pSHFLDPath, &parms); 445 445 if (rc == 0) 446 446 *Info = parms.Info; -
trunk/src/VBox/Additions/darwin/VBoxSF/VBoxSF-VNodeOps.cpp
r75293 r75666 28 28 29 29 30 #define VNODEOPFUNC int(*)(void *) 31 32 33 static int vboxvfs_dfl_error() 30 int vboxvfs_dfl_error(void) 34 31 { 35 32 PDEBUG("vboxvfs_dfl_error is called"); … … 38 35 } 39 36 40 static int 41 vboxvfs_vnode_getattr(struct vnop_getattr_args *args) 37 int vboxvfs_vnode_getattr(struct vnop_getattr_args *args) 42 38 { 43 39 vboxvfs_mount_t *pMount; … … 252 248 } 253 249 254 static int 255 vboxvfs_vnode_lookup(struct vnop_lookup_args *args) 250 int vboxvfs_vnode_lookup(struct vnop_lookup_args *args) 256 251 { 257 252 int rc; … … 340 335 } 341 336 342 static int 343 vboxvfs_vnode_open(struct vnop_open_args *args) 337 int vboxvfs_vnode_open(struct vnop_open_args *args) 344 338 { 345 339 vnode_t vnode; … … 405 399 } 406 400 407 static int 408 vboxvfs_vnode_close(struct vnop_close_args *args) 401 int vboxvfs_vnode_close(struct vnop_close_args *args) 409 402 { 410 403 vnode_t vnode; … … 509 502 } 510 503 511 static int 512 vboxvfs_vnode_readdir(struct vnop_readdir_args *args) 504 int vboxvfs_vnode_readdir(struct vnop_readdir_args *args) 513 505 { 514 506 vboxvfs_mount_t *pMount; … … 580 572 uint32_t cbReturned = cbInfo; 581 573 //rc = VbglR0SfDirInfo(&g_vboxSFClient, &pMount->pMap, Handle, pMask, SHFL_LIST_RETURN_ONE, 0, &cbReturned, (PSHFLDIRINFO)Info, &cFiles); 582 rc = VbglR0SfDirInfo(&g_ vboxSFClient, &pMount->pMap, Handle, 0, SHFL_LIST_RETURN_ONE, 0,574 rc = VbglR0SfDirInfo(&g_SfClient, &pMount->pMap, Handle, 0, SHFL_LIST_RETURN_ONE, 0, 583 575 &cbReturned, (PSHFLDIRINFO)Info, &cFiles); 584 576 … … 631 623 } 632 624 633 static int 634 vboxvfs_vnode_access(struct vnop_access_args *args)625 626 int vboxvfs_vnode_access(struct vnop_access_args *args) 635 627 { 636 628 PDEBUG("here"); … … 639 631 640 632 641 static int 642 vboxvfs_vnode_readdirattr(struct vnop_readdirattr_args *args) 633 int vboxvfs_vnode_readdirattr(struct vnop_readdirattr_args *args) 643 634 { 644 635 PDEBUG("here"); … … 646 637 } 647 638 648 static int 649 vboxvfs_vnode_pathconf(struct vnop_pathconf_args *args) 639 int vboxvfs_vnode_pathconf(struct vnop_pathconf_args *args) 650 640 { 651 641 PDEBUG("here"); … … 662 652 * @return 0 on success, BSD error code otherwise. 663 653 */ 664 static int 665 vboxvfs_vnode_reclaim(struct vnop_reclaim_args *pArgs) 654 int vboxvfs_vnode_reclaim(struct vnop_reclaim_args *pArgs) 666 655 { 667 656 PDEBUG("Releasing vnode resources..."); … … 701 690 } 702 691 703 /* Directory vnode operations */ 704 static struct vnodeopv_entry_desc oVBoxVFSDirOpsDescList[] = { 692 693 /** 694 * Vnode operations. 695 */ 696 static struct vnodeopv_entry_desc g_VBoxSfDirOpsDescList[] = 697 { 698 #define VNODEOPFUNC int(*)(void *) 705 699 { &vnop_default_desc, (VNODEOPFUNC)vboxvfs_dfl_error }, 706 700 { &vnop_lookup_desc, (VNODEOPFUNC)vboxvfs_vnode_lookup }, … … 748 742 { &vnop_bwrite_desc, (VNODEOPFUNC)vboxvfs_dfl_error }, 749 743 { NULL, (VNODEOPFUNC)NULL }, 744 #undef VNODEOPFUNC 750 745 }; 751 746 752 int (**g_VBoxVFSVnodeDirOpsVector)(void *); 753 754 static struct vnodeopv_desc oVBoxVFSVnodeDirOps = { 755 &g_VBoxVFSVnodeDirOpsVector, 756 oVBoxVFSDirOpsDescList 747 /** ??? */ 748 int (**g_papfnVBoxVFSVnodeDirOpsVector)(void *); 749 750 /** 751 * VNode operation descriptors. 752 */ 753 struct vnodeopv_desc g_VBoxSfVnodeOpvDesc = 754 { 755 &g_papfnVBoxVFSVnodeDirOpsVector, 756 g_VBoxSfDirOpsDescList 757 757 }; 758 758 759 struct vnodeopv_desc *g_VBoxVFSVnodeOpvDescList[] = {760 &oVBoxVFSVnodeDirOps,761 };762 763 int g_cVBoxVFSVnodeOpvDescListSize =764 sizeof(**g_VBoxVFSVnodeOpvDescList) / sizeof(struct vnodeopv_desc); -
trunk/src/VBox/Additions/darwin/VBoxSF/VBoxSF-VfsOps.cpp
r75293 r75666 275 275 if (pMount) 276 276 { 277 rc = VbglR0SfMapFolder(&g_ vboxSFClient, pMount->pShareName, &pMount->pMap);277 rc = VbglR0SfMapFolder(&g_SfClient, pMount->pShareName, &pMount->pMap); 278 278 if (RT_SUCCESS(rc)) 279 279 { … … 342 342 vfs_setfsprivate(mp, NULL); 343 343 344 rc = VbglR0SfUnmapFolder(&g_ vboxSFClient, &pMount->pMap);344 rc = VbglR0SfUnmapFolder(&g_SfClient, &pMount->pMap); 345 345 if (RT_SUCCESS(rc)) 346 346 { … … 504 504 AssertReturn(pMount->pShareName, EINVAL); 505 505 506 rc = VbglR0SfFsInfo(&g_ vboxSFClient, &pMount->pMap, 0, SHFL_INFO_GET | SHFL_INFO_VOLUME,506 rc = VbglR0SfFsInfo(&g_SfClient, &pMount->pMap, 0, SHFL_INFO_GET | SHFL_INFO_VOLUME, 507 507 &cbBuffer, (PSHFLDIRINFO)&SHFLVolumeInfo); 508 508 AssertReturn(rc == 0, EPROTO); … … 553 553 } 554 554 555 /* VFS options */ 556 struct vfsops g_oVBoxVFSOpts = { 555 /** 556 * VFS operations 557 */ 558 struct vfsops g_VBoxSfVfsOps = 559 { 557 560 /* Standard operations */ 558 561 &vboxvfs_mount, -
trunk/src/VBox/Additions/darwin/VBoxSF/VBoxSF.cpp
r75293 r75666 33 33 *********************************************************************************************************************************/ 34 34 /** 35 * The service class for dealing with Share Folder filesystem. 36 */ 37 class org_virtualbox_VBoxVFS : public IOService 38 { 39 OSDeclareDefaultStructors(org_virtualbox_VBoxVFS); 35 * The service class for this driver. 36 * 37 * This has one purpose: Use waitForMatchingService() to find VBoxGuest. 38 */ 39 class org_virtualbox_VBoxSF : public IOService 40 { 41 OSDeclareDefaultStructors(org_virtualbox_VBoxSF); 40 42 41 43 private: 42 IOService * 43 44 IOService * coreService;44 IOService *waitForCoreService(void); 45 46 IOService *m_pCoreService; 45 47 46 48 public: … … 49 51 }; 50 52 51 OSDefineMetaClassAndStructors(org_virtualbox_VBox VFS, IOService);53 OSDefineMetaClassAndStructors(org_virtualbox_VBoxSF, IOService); 52 54 53 55 … … 55 57 * Global Variables * 56 58 *********************************************************************************************************************************/ 57 58 59 /** 59 60 * Declare the module stuff. 60 61 */ 61 62 RT_C_DECLS_BEGIN 62 static kern_return_t VBox VFSModuleLoad(struct kmod_info *pKModInfo, void *pvData);63 static kern_return_t VBox VFSModuleUnLoad(struct kmod_info *pKModInfo, void *pvData);63 static kern_return_t VBoxSfModuleLoad(struct kmod_info *pKModInfo, void *pvData); 64 static kern_return_t VBoxSfModuleUnload(struct kmod_info *pKModInfo, void *pvData); 64 65 extern kern_return_t _start(struct kmod_info *pKModInfo, void *pvData); 65 66 extern kern_return_t _stop(struct kmod_info *pKModInfo, void *pvData); 66 67 KMOD_EXPLICIT_DECL(VBoxVFS, VBOX_VERSION_STRING, _start, _stop) 67 DECLHIDDEN(kmod_start_func_t *) _realmain = VBox VFSModuleLoad;68 DECLHIDDEN(kmod_stop_func_t *) _antimain = VBox VFSModuleUnLoad;68 DECLHIDDEN(kmod_start_func_t *) _realmain = VBoxSfModuleLoad; 69 DECLHIDDEN(kmod_stop_func_t *) _antimain = VBoxSfModuleUnload; 69 70 DECLHIDDEN(int) _kext_apple_cc = __APPLE_CC__; 70 71 RT_C_DECLS_END 71 72 72 /** The number of IOService class instances. */ 73 static bool volatile g_fInstantiated = 0; 74 /* Global connection to the host service */ 75 VBGLSFCLIENT g_vboxSFClient; 73 /** The org_virtualbox_VBoxSF instance. 74 * Used for preventing multiple instantiations. */ 75 static org_virtualbox_VBoxSF *g_pService = NULL; 76 77 /** The shared folder service client structure. */ 78 VBGLSFCLIENT g_SfClient; 76 79 /* VBoxVFS filesystem handle. Needed for FS unregistering. */ 77 static vfstable_t g_oVBoxVFSHandle; 80 static vfstable_t g_pVBoxSfVfsTableEntry; 81 82 /** For vfs_fsentry. */ 83 static struct vnodeopv_desc *g_apVBoxSfVnodeOpDescList[] = 84 { 85 &g_VBoxSfVnodeOpvDesc, 86 }; 87 88 89 /** VFS registration structure. */ 90 static struct vfs_fsentry g_VBoxSfFsEntry = 91 { 92 .vfe_vfsops = &g_VBoxSfVfsOps, 93 .vfe_vopcnt = RT_ELEMENTS(g_apVBoxSfVnodeOpDescList), 94 .vfe_opvdescs = g_apVBoxSfVnodeOpDescList, 95 .vfe_fstypenum = -1, 96 .vfe_fsname = VBOXSF_DARWIN_FS_NAME, 97 .vfe_flags = VFS_TBLTHREADSAFE /* Required. */ 98 | VFS_TBLFSNODELOCK /* Required. */ 99 | VFS_TBLNOTYPENUM /* No historic file system number. */ 100 | VFS_TBL64BITREADY, /* Can handle 64-bit processes */ 101 /** @todo add VFS_TBLREADDIR_EXTENDED */ 102 .vfe_reserv = { NULL, NULL }, 103 }; 78 104 79 105 … … 81 107 * KEXT Module BSD entry point 82 108 */ 83 static kern_return_t VBoxVFSModuleLoad(struct kmod_info *pKModInfo, void *pvData) 84 { 85 int rc; 86 109 static kern_return_t VBoxSfModuleLoad(struct kmod_info *pKModInfo, void *pvData) 110 { 87 111 /* Initialize the R0 guest library. */ 88 112 #if 0 … … 102 126 * KEXT Module BSD exit point 103 127 */ 104 static kern_return_t VBoxVFSModuleUnLoad(struct kmod_info *pKModInfo, void *pvData) 105 { 106 int rc; 107 128 static kern_return_t VBoxSfModuleUnload(struct kmod_info *pKModInfo, void *pvData) 129 { 108 130 #if 0 109 131 VbglR0SfTerm(); … … 115 137 } 116 138 117 118 /** 119 * Register VBoxFS filesystem. 120 * 121 * @returns IPRT status code. 122 */ 123 int VBoxVFSRegisterFilesystem(void) 124 { 125 struct vfs_fsentry oVFsEntry; 126 int rc; 127 128 memset(&oVFsEntry, 0, sizeof(oVFsEntry)); 129 /* Attach filesystem operations set */ 130 oVFsEntry.vfe_vfsops = &g_oVBoxVFSOpts; 131 /* Attach vnode operations */ 132 oVFsEntry.vfe_vopcnt = g_cVBoxVFSVnodeOpvDescListSize; 133 oVFsEntry.vfe_opvdescs = g_VBoxVFSVnodeOpvDescList; 134 /* Set flags */ 135 oVFsEntry.vfe_flags = 136 #if ARCH_BITS == 64 137 VFS_TBL64BITREADY | 138 #endif 139 VFS_TBLTHREADSAFE | 140 VFS_TBLFSNODELOCK | 141 VFS_TBLNOTYPENUM; 142 143 memcpy(oVFsEntry.vfe_fsname, VBOXSF_DARWIN_FS_NAME, MFSNAMELEN); 144 145 rc = vfs_fsadd(&oVFsEntry, &g_oVBoxVFSHandle); 146 if (rc) 147 { 148 PINFO("Unable to register VBoxVFS filesystem (%d)", rc); 149 return VERR_GENERAL_FAILURE; 150 } 151 152 PINFO("VBoxVFS filesystem successfully registered"); 153 return VINF_SUCCESS; 154 } 155 156 /** 157 * Unregister VBoxFS filesystem. 158 * 159 * @returns IPRT status code. 160 */ 161 int VBoxVFSUnRegisterFilesystem(void) 162 { 163 int rc; 164 165 if (g_oVBoxVFSHandle == 0) 166 return VERR_INVALID_PARAMETER; 167 168 rc = vfs_fsremove(g_oVBoxVFSHandle); 169 if (rc) 170 { 171 PINFO("Unable to unregister VBoxVFS filesystem (%d)", rc); 172 return VERR_GENERAL_FAILURE; 173 } 174 175 g_oVBoxVFSHandle = 0; 176 177 PINFO("VBoxVFS filesystem successfully unregistered"); 178 return VINF_SUCCESS; 139 /** 140 * Wait for VBoxGuest.kext to be started 141 */ 142 IOService *org_virtualbox_VBoxSF::waitForCoreService(void) 143 { 144 OSDictionary *pServiceToMatach = serviceMatching("org_virtualbox_VBoxGuest"); 145 if (pServiceToMatach) 146 { 147 /* Wait 15 seconds for VBoxGuest to be started */ 148 IOService *pService = waitForMatchingService(pServiceToMatach, 15 * RT_NS_1SEC_64); 149 pServiceToMatach->release(); 150 return pService; 151 } 152 PINFO("unable to create matching dictionary"); 153 return NULL; 179 154 } 180 155 … … 183 158 * Start this service. 184 159 */ 185 bool org_virtualbox_VBoxVFS::start(IOService *pProvider) 186 { 187 int rc; 188 189 if (!IOService::start(pProvider)) 160 bool org_virtualbox_VBoxSF::start(IOService *pProvider) 161 { 162 if (g_pService == NULL) 163 g_pService = this; 164 else 165 { 166 printf("org_virtualbox_VBoxSF::start: g_pService=%p this=%p -> false\n", g_pService, this); 190 167 return false; 191 192 /* Low level initialization should be performed only once */ 193 if (!ASMAtomicCmpXchgBool(&g_fInstantiated, true, false)) 194 { 195 IOService::stop(pProvider); 196 return false; 197 } 198 199 /* Wait for VBoxGuest to be started */ 200 coreService = waitForCoreService(); 201 if (coreService) 202 { 203 rc = VbglR0SfInit(); 204 if (RT_SUCCESS(rc)) 168 } 169 170 if (IOService::start(pProvider)) 171 { 172 /* 173 * Get hold of VBoxGuest. 174 */ 175 m_pCoreService = waitForCoreService(); 176 if (m_pCoreService) 205 177 { 206 /* Connect to the host service. */ 207 rc = VbglR0SfConnect(&g_vboxSFClient); 178 int rc = VbglR0SfInit(); 208 179 if (RT_SUCCESS(rc)) 209 180 { 210 PINFO("VBox client connected"); 211 rc = VbglR0SfSetUtf8(&g_vboxSFClient); 181 /* 182 * Connect to the host service and set UTF-8 as the string encoding to use. 183 */ 184 rc = VbglR0SfConnect(&g_SfClient); 212 185 if (RT_SUCCESS(rc)) 213 186 { 214 rc = V BoxVFSRegisterFilesystem();187 rc = VbglR0SfSetUtf8(&g_SfClient); 215 188 if (RT_SUCCESS(rc)) 216 189 { 217 registerService(); 218 PINFO("Successfully started I/O kit class instance"); 219 return true; 190 /* 191 * Register the file system. 192 */ 193 rc = vfs_fsadd(&g_VBoxSfFsEntry, &g_pVBoxSfVfsTableEntry); 194 if (rc == 0) 195 { 196 registerService(); 197 198 LogRel(("VBoxSF: ready\n")); 199 return true; 200 } 201 202 LogRel(("VBoxSF: vfs_fsadd failed: %d\n", rc)); 220 203 } 221 PERROR("Unable to register VBoxVFS filesystem"); 204 else 205 LogRel(("VBoxSF: VbglR0SfSetUtf8 failed: %Rrc\n", rc)); 206 VbglR0SfDisconnect(&g_SfClient); 222 207 } 223 208 else 224 { 225 PERROR("VbglR0SfSetUtf8 failed: rc=%d", rc); 226 } 227 VbglR0SfDisconnect(&g_vboxSFClient); 209 LogRel(("VBoxSF: VbglR0SfConnect failed: %Rrc\n", rc)); 210 VbglR0SfTerm(); 211 } 212 else 213 LogRel(("VBoxSF: VbglR0SfInit failed: %Rrc\n", rc)); 214 m_pCoreService->release(); 215 } 216 else 217 LogRel(("VBoxSF: Failed to find VBoxGuest!\n")); 218 219 IOService::stop(pProvider); 220 } 221 g_pService = NULL; 222 return false; 223 } 224 225 226 /** 227 * Stop this service. 228 */ 229 void org_virtualbox_VBoxSF::stop(IOService *pProvider) 230 { 231 if (m_pCoreService == this) 232 { 233 /* 234 * Unregister the filesystem. 235 */ 236 if (g_pVBoxSfVfsTableEntry != NULL) 237 { 238 int rc = vfs_fsremove(g_pVBoxSfVfsTableEntry); 239 if (rc == 0) 240 { 241 g_pVBoxSfVfsTableEntry = NULL; 242 PINFO("VBoxVFS filesystem successfully unregistered"); 228 243 } 229 244 else 230 245 { 231 PERROR("Failed to get connection to host: rc=%d", rc); 246 PINFO("Unable to unregister the VBoxSF filesystem (%d)", rc); 247 /** @todo how on earth do we deal with this... Gues we shouldn't be using 248 * IOService at all here. sigh. */ 232 249 } 233 VbglR0SfTerm();234 250 } 235 else 236 { 237 PERROR("Failed to initialize low level library"); 238 } 239 coreService->release(); 240 } 241 else 242 { 243 PERROR("VBoxGuest KEXT not started"); 244 } 245 246 ASMAtomicXchgBool(&g_fInstantiated, false); 251 VbglR0SfDisconnect(&g_SfClient); 252 VbglR0SfTerm(); 253 if (m_pCoreService) 254 m_pCoreService->release(); 255 256 } 247 257 IOService::stop(pProvider); 248 249 return false; 250 } 251 252 253 /** 254 * Stop this service. 255 */ 256 void org_virtualbox_VBoxVFS::stop(IOService *pProvider) 257 { 258 int rc; 259 260 AssertReturnVoid(ASMAtomicReadBool(&g_fInstantiated)); 261 262 rc = VBoxVFSUnRegisterFilesystem(); 263 if (RT_FAILURE(rc)) 264 { 265 PERROR("VBoxVFS filesystem is busy. Make sure all " 266 "shares are unmounted (%d)", rc); 267 } 268 269 VbglR0SfDisconnect(&g_vboxSFClient); 270 PINFO("VBox client disconnected"); 271 272 VbglR0SfTerm(); 273 PINFO("Low level uninit done"); 274 275 coreService->release(); 276 PINFO("VBoxGuest service released"); 277 278 IOService::stop(pProvider); 279 280 ASMAtomicWriteBool(&g_fInstantiated, false); 281 282 PINFO("Successfully stopped I/O kit class instance"); 283 } 284 285 286 /** 287 * Wait for VBoxGuest.kext to be started 288 */ 289 IOService * org_virtualbox_VBoxVFS::waitForCoreService(void) 290 { 291 IOService *service; 292 293 OSDictionary *serviceToMatch = serviceMatching("org_virtualbox_VBoxGuest"); 294 if (!serviceToMatch) 295 { 296 PINFO("unable to create matching dictionary"); 297 return NULL; 298 } 299 300 /* Wait 10 seconds for VBoxGuest to be started */ 301 service = waitForMatchingService(serviceToMatch, 10ULL * 1000000000ULL); 302 serviceToMatch->release(); 303 304 return service; 305 } 258 } 259 -
trunk/src/VBox/Additions/darwin/VBoxSF/VBoxSFInternal.h
r75293 r75666 82 82 * Global Variables * 83 83 *********************************************************************************************************************************/ 84 /** Global refernce to host service connection */ 85 extern VBGLSFCLIENT g_vboxSFClient; 86 87 /* VFS options */ 88 extern struct vfsops g_oVBoxVFSOpts; 89 90 extern int (**g_VBoxVFSVnodeDirOpsVector)(void *); 91 extern int g_cVBoxVFSVnodeOpvDescListSize; 92 extern struct vnodeopv_desc *g_VBoxVFSVnodeOpvDescList[]; 84 extern VBGLSFCLIENT g_SfClient; 85 extern struct vfsops g_VBoxSfVfsOps; 86 extern struct vnodeopv_desc g_VBoxSfVnodeOpvDesc; 87 extern int (**g_papfnVBoxVFSVnodeDirOpsVector)(void *); 93 88 94 89
Note:
See TracChangeset
for help on using the changeset viewer.