Changeset 10067 in vbox for trunk/src/VBox
- Timestamp:
- Jul 1, 2008 11:07:51 AM (17 years ago)
- Location:
- trunk/src/VBox/Additions/solaris/SharedFolders
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/solaris/SharedFolders/Makefile.kmk
r10030 r10067 30 30 vboxvfs_SOURCES = \ 31 31 vboxvfs_vfsops.c \ 32 vboxvfs_vnops.c 32 vboxvfs_vnops.c \ 33 vboxvfs_utils.c 33 34 vboxvfs_LIBS = \ 34 35 $(VBOX_LIB_VBGL_R0) \ -
trunk/src/VBox/Additions/solaris/SharedFolders/vboxvfs.h
r9672 r10067 21 21 #define MAX_NLS_NAME 32 22 22 23 /** The module name. */ 24 #define DEVICE_NAME "vboxvfs" 25 /** The module description as seen in 'modinfo'. */ 26 #define DEVICE_DESC "filesystem for VirtualBox Shared Folders" 27 23 28 /* Not sure if we need this; it seems only necessary for kernel mounts. */ 24 29 #if 0 … … 39 44 #include <sys/vfs_opreg.h> 40 45 46 /** VNode for VBoxVFS */ 47 typedef struct vboxvfs_vnode 48 { 49 vnode_t *pVNode; 50 vattr_t Attr; 51 SHFLSTRING *pPath; 52 kmutex_t MtxContents; 53 } vboxvfs_vnode_t; 54 55 41 56 /** Per-file system mount instance data. */ 42 57 typedef struct vboxvfs_globinfo 43 58 { 44 VBSFMAP Map;45 int Ttl;46 int Uid;47 int Gid;48 vfs_t *pVFS;49 vnode_t *pVNodeDev;50 v node_t *pVNodeRoot;59 VBSFMAP Map; 60 int Ttl; 61 int Uid; 62 int Gid; 63 vfs_t *pVFS; 64 vnode_t *pVNodeDev; 65 vboxvfs_vnode_t *pVNodeRoot; 51 66 } vboxvfs_globinfo_t; 52 67 53 68 extern struct vnodeops *g_pVBoxVFS_vnodeops; 54 69 extern const fs_operation_def_t g_VBoxVFS_vnodeops_template[]; 70 extern VBSFCLIENT g_VBoxVFSClient; 71 72 /** Helper functions */ 73 extern int vboxvfs_Stat(const char *pszCaller, vboxvfs_globinfo_t *pVBoxVFSGlobalInfo, SHFLSTRING *pPath, 74 RTFSOBJINFO *pResult, boolean_t fAllowFailure); 75 extern void vboxvfs_InitVNode(vboxvfs_globinfo_t *pVBoxVFSGlobalInfo, vboxvfs_vnode_t *pVBoxVNode, 76 RTFSOBJINFO *pFSInfo); 77 78 79 /** Helper macros */ 80 #define VFS_TO_VBOXVFS(vfs) ((vboxvfs_globinfo_t *)((vfs)->vfs_data)) 81 #define VBOXVFS_TO_VFS(vboxvfs) ((vboxvfs)->pVFS) 82 #define VN_TO_VBOXVN(vnode) ((vboxvfs_vnode_t *)((vnode)->v_data)) 83 #define VBOXVN_TO_VN(vboxvnode) ((vboxvnode)->pVNode) 55 84 56 85 #endif /* _KERNEL */ -
trunk/src/VBox/Additions/solaris/SharedFolders/vboxvfs_vfsops.c
r10023 r10067 1 1 /* $Id$ */ 2 2 /** @file 3 * VirtualBox File System Driver for Solaris Guests. 3 * VirtualBox File System Driver for Solaris Guests. VFS operations. 4 4 */ 5 5 … … 38 38 * Defined Constants And Macros * 39 39 *******************************************************************************/ 40 /** The module name. */41 #define DEVICE_NAME "vboxvfs"42 /** The module description as seen in 'modinfo'. */43 #define DEVICE_DESC "filesystem for VirtualBox Shared Folders"44 45 40 /** Mount Options */ 46 41 #define MNTOPT_VBOXVFS_UID "uid" 47 42 #define MNTOPT_VBOXVFS_GID "gid" 48 49 /** Helpers */50 #define VFS2VBOXVFS(vfs) ((vboxvfs_globinfo_t *)((vfs)->vfs_data))51 #define VBOXVFS2VFS(vboxvfs) ((vboxvfs)->pVFS)52 43 53 44 … … 141 132 unsigned __gxx_personality_v0 = 0xdecea5ed; 142 133 /** Global connection to the client. */ 143 staticVBSFCLIENT g_VBoxVFSClient;134 VBSFCLIENT g_VBoxVFSClient; 144 135 /** Global VFS Operations pointer. */ 145 136 vfsops_t *g_pVBoxVFS_vfsops; … … 262 253 size_t cbShare = NULL; 263 254 pathname_t PathName; 255 vboxvfs_vnode_t *pVNodeRoot = NULL; 264 256 vnode_t *pVNodeSpec = NULL; 265 257 vnode_t *pVNodeDev = NULL; 266 258 dev_t Dev = 0; 267 259 SHFLSTRING *pShflShareName = NULL; 260 RTFSOBJINFO FSInfo; 268 261 size_t cbShflShareName = 0; 269 262 vboxvfs_globinfo_t *pVBoxVFSGlobalInfo = NULL; … … 418 411 419 412 /* Allocate the global info. structure. */ 420 pVBoxVFSGlobalInfo = RTMemAlloc Z(sizeof(*pVBoxVFSGlobalInfo));413 pVBoxVFSGlobalInfo = RTMemAlloc(sizeof(*pVBoxVFSGlobalInfo)); 421 414 if (!pVBoxVFSGlobalInfo) 422 415 { 423 LogRel((DEVICE_NAME ":VBoxVFS_Mount: RTMemAlloc Zfailed to alloc %d bytes for global struct.\n", sizeof(*pVBoxVFSGlobalInfo)));416 LogRel((DEVICE_NAME ":VBoxVFS_Mount: RTMemAlloc failed to alloc %d bytes for global struct.\n", sizeof(*pVBoxVFSGlobalInfo))); 424 417 return ENOMEM; 425 418 } … … 457 450 vfs_make_fsid(&pVFS->vfs_fsid, Dev, g_VBoxVFSType); 458 451 459 /* @todo root vnode */ 452 /* Allocate root vboxvfs_vnode_t object */ 453 pVNodeRoot = RTMemAlloc(sizeof(*pVNodeRoot)); 454 if (!pVNodeRoot) 455 { 456 LogRel((DEVICE_NAME ":VBoxVFS_Mount: RTMemAlloc failed to alloc %d bytes for root node.\n", sizeof(*pVNodeRoot))); 457 return ENOMEM; 458 } 459 460 /* Initialize the mutex */ 461 mutex_init(&pVNodeRoot->MtxContents, "VNodeMtx", MUTEX_DEFAULT, NULL); 462 463 /* Allocate root path */ 464 pVNodeRoot->pPath = RTMemAllocZ(sizeof(SHFLSTRING) + 1); 465 if (!pVNodeRoot->pPath) 466 { 467 LogRel((DEVICE_NAME ":VBoxVFS_Mount: RTMemAllocZ failed to alloc %d bytes for root path.\n", sizeof(SHFLSTRING) + 1)); 468 return ENOMEM; 469 } 470 471 /* Initialize root path */ 472 pVNodeRoot->pPath->u16Length = 1; 473 pVNodeRoot->pPath->u16Size = 2; 474 pVNodeRoot->pPath->String.utf8[0] = '/'; 475 pVNodeRoot->pPath->String.utf8[1] = '\0'; 476 477 /* Stat root node info from host */ 478 rc = vboxvfs_Stat(__func__, pVBoxVFSGlobalInfo, pVNodeRoot->pPath, &FSInfo, B_FALSE); 479 if (rc) 480 { 481 LogRel((DEVICE_NAME ":VBoxVFS_Mount: vboxvfs_Stat failed rc(errno)=%d\n", rc)); 482 return rc; 483 } 484 485 /* Initialize the root vboxvfs_node_t object */ 486 vboxvfs_InitVNode(pVBoxVFSGlobalInfo, pVNodeRoot, &FSInfo); 460 487 461 488 return 0; … … 482 509 /* @todo implement ref-counting of active vnodes & check for busy state here. */ 483 510 /* @todo mutex protection needed here */ 484 pVBoxVFSGlobalInfo = VFS 2VBOXVFS(pVFS);511 pVBoxVFSGlobalInfo = VFS_TO_VBOXVFS(pVFS); 485 512 486 513 rc = vboxCallUnmapFolder(&g_VBoxVFSClient, &pVBoxVFSGlobalInfo->Map); … … 488 515 LogRel((DEVICE_NAME ":VBoxVFS_Unmount: failed to unmap shared folder. rc=%d\n", rc)); 489 516 490 VN_RELE( pVBoxVFSGlobalInfo->pVNodeRoot);517 VN_RELE(VBOXVN_TO_VN(pVBoxVFSGlobalInfo->pVNodeRoot)); 491 518 492 519 RTMemFree(pVBoxVFSGlobalInfo); … … 498 525 static int VBoxVFS_Root(vfs_t *pVFS, vnode_t **ppVNode) 499 526 { 500 vboxvfs_globinfo_t *pVBoxVFSGlobalInfo = VFS 2VBOXVFS(pVFS);501 *ppVNode = pVBoxVFSGlobalInfo->pVNodeRoot;527 vboxvfs_globinfo_t *pVBoxVFSGlobalInfo = VFS_TO_VBOXVFS(pVFS); 528 *ppVNode = VBOXVN_TO_VN(pVBoxVFSGlobalInfo->pVNodeRoot); 502 529 VN_HOLD(*ppVNode); 503 530 … … 513 540 int rc; 514 541 515 pVBoxVFSGlobalInfo = VFS 2VBOXVFS(pVFS);542 pVBoxVFSGlobalInfo = VFS_TO_VBOXVFS(pVFS); 516 543 cbBuffer = sizeof(VolumeInfo); 517 544 rc = vboxCallFSInfo(&g_VBoxVFSClient, &pVBoxVFSGlobalInfo->Map, 0, SHFL_INFO_GET | SHFL_INFO_VOLUME, &cbBuffer, -
trunk/src/VBox/Additions/solaris/SharedFolders/vboxvfs_vnops.c
r9177 r10067 1 1 /* $Id$ */ 2 2 /** @file 3 * VirtualBox File System Driver for Solaris Guests .3 * VirtualBox File System Driver for Solaris Guests, VNode Operations. 4 4 */ 5 5
Note:
See TracChangeset
for help on using the changeset viewer.