Changeset 9672 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jun 13, 2008 8:01:07 AM (17 years ago)
- Location:
- trunk/src/VBox/Additions/solaris/SharedFolders
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/solaris/SharedFolders/vboxvfs.h
r9177 r9672 22 22 23 23 /* Not sure if we need this; it seems only necessary for kernel mounts. */ 24 #if 0 24 25 typedef struct vboxvfs_mountinfo 25 26 { … … 30 31 int ttl; 31 32 } vboxvfs_mountinfo_t; 33 #endif 32 34 33 35 #ifdef _KERNEL … … 45 47 int Gid; 46 48 vfs_t *pVFS; 47 dev_t Dev;48 49 vnode_t *pVNodeDev; 49 50 vnode_t *pVNodeRoot; -
trunk/src/VBox/Additions/solaris/SharedFolders/vboxvfs_vfsops.c
r9175 r9672 55 55 static int VBoxVFS_Root(vfs_t *pVFS, vnode_t **ppVNode); 56 56 static int VBoxVFS_Statfs(register vfs_t *pVFS, struct statvfs64 *pStat); 57 static int VBoxVFS_Sync(vfs_t *pVFS, short fFlags, cred_t *pCred);58 57 static int VBoxVFS_VGet(vfs_t *pVFS, vnode_t **ppVNode, struct fid *pFid); 59 58 static void VBoxVFS_FreeVFS(vfs_t *pVFS); … … 203 202 VFSNAME_ROOT, { .vfs_root = VBoxVFS_Root }, 204 203 VFSNAME_STATVFS, { .vfs_statvfs = VBoxVFS_Statfs }, 205 VFSNAME_SYNC, { .vfs_sync = VBoxVFS_Sync },206 204 VFSNAME_VGET, { .vfs_vget = VBoxVFS_VGet }, 207 205 VFSNAME_FREEVFS, { .vfs_freevfs = VBoxVFS_FreeVFS }, … … 296 294 mutex_exit(&pVNode->v_lock); 297 295 298 /* I don't think we really need to support kernel mount arguments anymore. */ 296 /* From what I understood the options are already parsed at a higher level */ 297 if ( (pMount->flags & MS_DATA) 298 && pMount->datalen > 0) 299 { 300 LogRel((DEVICE_NAME ":VBoxVFS_Mount: unparsed options not supported.\n")); 301 return EINVAL; 302 } 303 304 /* Will be removed eventually... */ 299 305 #if 0 300 306 /* Retreive arguments. */ … … 395 401 rc = EINVAL; 396 402 } 397 398 403 if (!rc) 399 404 { … … 403 408 404 409 /* Allocate the global info. structure. */ 405 pVBoxVFSGlobalInfo = RTMemAlloc (sizeof(*pVBoxVFSGlobalInfo));410 pVBoxVFSGlobalInfo = RTMemAllocZ(sizeof(*pVBoxVFSGlobalInfo)); 406 411 if (!pVBoxVFSGlobalInfo) 407 412 { 408 LogRel((DEVICE_NAME ":VBoxVFS_Mount: RTMemAlloc failed to alloc %d bytes for global struct.\n", sizeof(*pVBoxVFSGlobalInfo)));413 LogRel((DEVICE_NAME ":VBoxVFS_Mount: RTMemAllocZ failed to alloc %d bytes for global struct.\n", sizeof(*pVBoxVFSGlobalInfo))); 409 414 return ENOMEM; 410 415 } 411 416 412 cbShflShareName = offsetof 417 cbShflShareName = offsetof(SHFLSTRING, String.utf8) + cbShare + 1; 413 418 pShflShareName = RTMemAllocZ(cbShflShareName); 414 419 if (!pShflShareName) 415 420 { 416 421 RTMemFree(pVBoxVFSGlobalInfo); 417 LogRel((DEVICE_NAME ":VBoxVFS_Mount: RTMemAlloc failed to alloc %d bytes for ShFlShareName.\n", cbShflShareName));422 LogRel((DEVICE_NAME ":VBoxVFS_Mount: RTMemAllocZ failed to alloc %d bytes for ShFlShareName.\n", cbShflShareName)); 418 423 return ENOMEM; 419 424 } … … 436 441 pVBoxVFSGlobalInfo->Gid = Gid; 437 442 pVBoxVFSGlobalInfo->pVFS = pVFS; 438 pVBoxVFSGlobalInfo->Dev = Dev;439 443 pVBoxVFSGlobalInfo->pVNodeDev = pVNodeDev; 440 444 pVFS->vfs_data = pVBoxVFSGlobalInfo; 441 445 pVFS->vfs_fstype = g_VBoxVFSType; 446 pVFS->vfs_dev = Dev; 442 447 vfs_make_fsid(&pVFS->vfs_fsid, Dev, g_VBoxVFSType); 443 448 … … 473 478 LogRel((DEVICE_NAME ":VBoxVFS_Unmount: failed to unmap shared folder. rc=%d\n", rc)); 474 479 480 VN_RELE(pVBoxVFSGlobalInfo->pVNodeRoot); 481 475 482 RTMemFree(pVBoxVFSGlobalInfo); 476 483 pVFS->vfs_data = NULL; … … 481 488 static int VBoxVFS_Root(vfs_t *pVFS, vnode_t **ppVNode) 482 489 { 490 vboxvfs_globinfo_t *pVBoxVFSGlobalInfo = VFS2VBOXVFS(pVFS); 491 *ppVNode = pVBoxVFSGlobalInfo->pVNodeRoot; 492 VN_HOLD(*ppVNode); 493 483 494 return 0; 484 495 } … … 486 497 static int VBoxVFS_Statfs(register vfs_t *pVFS, struct statvfs64 *pStat) 487 498 { 499 SHFLVOLINFO VolumeInfo; 500 uint32_t cbBuffer; 501 vboxvfs_globinfo_t *pVBoxVFSGlobalInfo; 502 dev32_t Dev32; 503 int rc; 504 505 pVBoxVFSGlobalInfo = VFS2VBOXVFS(pVFS); 506 cbBuffer = sizeof(VolumeInfo); 507 rc = vboxCallFSInfo(&g_VBoxVFSClient, &pVBoxVFSGlobalInfo->Map, 0, SHFL_INFO_GET | SHFL_INFO_VOLUME, &cbBuffer, 508 (PSHFLDIRINFO)&VolumeInfo); 509 if (VBOX_FAILURE(rc)) 510 return RTErrConvertToErrno(rc); 511 512 bzero(pStat, sizeof(*pStat)); 513 cmpldev(&Dev32, pVFS->vfs_dev); 514 pStat->f_fsid = Dev32; 515 pStat->f_flag = vf_to_stf(pVFS->vfs_flag); 516 pStat->f_bsize = VolumeInfo.ulBytesPerAllocationUnit; 517 pStat->f_frsize = VolumeInfo.ulBytesPerAllocationUnit; 518 pStat->f_bfree = VolumeInfo.ullAvailableAllocationBytes / VolumeInfo.ulBytesPerAllocationUnit; 519 pStat->f_bavail = VolumeInfo.ullAvailableAllocationBytes / VolumeInfo.ulBytesPerAllocationUnit; 520 pStat->f_blocks = VolumeInfo.ullTotalAllocationBytes / VolumeInfo.ulBytesPerAllocationUnit; 521 pStat->f_files = 1000; 522 pStat->f_ffree = 1000; /* don't return 0 here since the guest may think that it is not possible to create any more files */ 523 pStat->f_namemax = 255; /* @todo is this correct?? */ 524 525 strlcpy(pStat->f_basetype, vfssw[pVFS->vfs_fstype].vsw_name, sizeof(pStat->f_basetype)); 526 strlcpy(pStat->f_fstr, DEVICE_NAME, sizeof(pStat->f_fstr)); 527 488 528 return 0; 489 529 } 490 530 491 static int VBoxVFS_Sync(vfs_t *pVFS, short fFlags, cred_t *pCred)492 {493 return 0;494 }495 496 531 static int VBoxVFS_VGet(vfs_t *pVFS, vnode_t **ppVNode, struct fid *pFid) 497 532 { 533 /* -- TODO -- */ 498 534 return 0; 499 535 }
Note:
See TracChangeset
for help on using the changeset viewer.