VirtualBox

Changeset 9672 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jun 13, 2008 8:01:07 AM (17 years ago)
Author:
vboxsync
Message:

Solaris vboxvfs: more untested code.

Location:
trunk/src/VBox/Additions/solaris/SharedFolders
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/solaris/SharedFolders/vboxvfs.h

    r9177 r9672  
    2222
    2323/* Not sure if we need this; it seems only necessary for kernel mounts. */
     24#if 0
    2425typedef struct vboxvfs_mountinfo
    2526{
     
    3031    int ttl;
    3132} vboxvfs_mountinfo_t;
     33#endif
    3234
    3335#ifdef _KERNEL
     
    4547    int Gid;
    4648    vfs_t *pVFS;
    47     dev_t Dev;
    4849    vnode_t *pVNodeDev;
    4950    vnode_t *pVNodeRoot;
  • trunk/src/VBox/Additions/solaris/SharedFolders/vboxvfs_vfsops.c

    r9175 r9672  
    5555static int VBoxVFS_Root(vfs_t *pVFS, vnode_t **ppVNode);
    5656static int VBoxVFS_Statfs(register vfs_t *pVFS, struct statvfs64 *pStat);
    57 static int VBoxVFS_Sync(vfs_t *pVFS, short fFlags, cred_t *pCred);
    5857static int VBoxVFS_VGet(vfs_t *pVFS, vnode_t **ppVNode, struct fid *pFid);
    5958static void VBoxVFS_FreeVFS(vfs_t *pVFS);
     
    203202                    VFSNAME_ROOT,     { .vfs_root =      VBoxVFS_Root    },
    204203                    VFSNAME_STATVFS,  { .vfs_statvfs =   VBoxVFS_Statfs  },
    205                     VFSNAME_SYNC,     { .vfs_sync =      VBoxVFS_Sync    },
    206204                    VFSNAME_VGET,     { .vfs_vget =      VBoxVFS_VGet    },
    207205                    VFSNAME_FREEVFS,  { .vfs_freevfs =   VBoxVFS_FreeVFS },
     
    296294    mutex_exit(&pVNode->v_lock);
    297295
    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... */
    299305#if 0
    300306    /* Retreive arguments. */
     
    395401        rc = EINVAL;
    396402    }
    397 
    398403    if (!rc)
    399404    {
     
    403408
    404409    /* Allocate the global info. structure. */
    405     pVBoxVFSGlobalInfo = RTMemAlloc(sizeof(*pVBoxVFSGlobalInfo));
     410    pVBoxVFSGlobalInfo = RTMemAllocZ(sizeof(*pVBoxVFSGlobalInfo));
    406411    if (!pVBoxVFSGlobalInfo)
    407412    {
    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)));
    409414        return ENOMEM;
    410415    }
    411416
    412     cbShflShareName = offsetof (SHFLSTRING, String.utf8) + cbShare + 1;
     417    cbShflShareName = offsetof(SHFLSTRING, String.utf8) + cbShare + 1;
    413418    pShflShareName  = RTMemAllocZ(cbShflShareName);
    414419    if (!pShflShareName)
    415420    {
    416421        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));
    418423        return ENOMEM;
    419424    }
     
    436441    pVBoxVFSGlobalInfo->Gid = Gid;
    437442    pVBoxVFSGlobalInfo->pVFS = pVFS;
    438     pVBoxVFSGlobalInfo->Dev = Dev;
    439443    pVBoxVFSGlobalInfo->pVNodeDev = pVNodeDev;
    440444    pVFS->vfs_data = pVBoxVFSGlobalInfo;
    441445    pVFS->vfs_fstype = g_VBoxVFSType;
     446    pVFS->vfs_dev = Dev;
    442447    vfs_make_fsid(&pVFS->vfs_fsid, Dev, g_VBoxVFSType);
    443448
     
    473478        LogRel((DEVICE_NAME ":VBoxVFS_Unmount: failed to unmap shared folder. rc=%d\n", rc));
    474479
     480    VN_RELE(pVBoxVFSGlobalInfo->pVNodeRoot);
     481
    475482    RTMemFree(pVBoxVFSGlobalInfo);
    476483    pVFS->vfs_data = NULL;
     
    481488static int VBoxVFS_Root(vfs_t *pVFS, vnode_t **ppVNode)
    482489{
     490    vboxvfs_globinfo_t *pVBoxVFSGlobalInfo = VFS2VBOXVFS(pVFS);
     491    *ppVNode = pVBoxVFSGlobalInfo->pVNodeRoot;
     492    VN_HOLD(*ppVNode);
     493
    483494    return 0;
    484495}
     
    486497static int VBoxVFS_Statfs(register vfs_t *pVFS, struct statvfs64 *pStat)
    487498{
     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
    488528    return 0;
    489529}
    490530
    491 static int VBoxVFS_Sync(vfs_t *pVFS, short fFlags, cred_t *pCred)
    492 {
    493     return 0;
    494 }
    495 
    496531static int VBoxVFS_VGet(vfs_t *pVFS, vnode_t **ppVNode, struct fid *pFid)
    497532{
     533    /* -- TODO -- */
    498534    return 0;
    499535}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette