VirtualBox

Changeset 77951 in vbox for trunk


Ignore:
Timestamp:
Mar 29, 2019 1:26:53 PM (6 years ago)
Author:
vboxsync
Message:

linux/vboxsf: sf_g -> pSuperInfo. bugref:9172

Location:
trunk/src/VBox/Additions/linux/sharedfolders
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/sharedfolders/dirops.c

    r77873 r77951  
    5151static int vbsf_dir_open(struct inode *inode, struct file *file)
    5252{
    53     struct vbsf_super_info *sf_g  = VBSF_GET_SUPER_INFO(inode->i_sb);
    54     struct vbsf_inode_info *sf_i   = VBSF_GET_INODE_INFO(inode);
    55     struct dentry          *dentry = VBSF_GET_F_DENTRY(file);
     53    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
     54    struct vbsf_inode_info *sf_i       = VBSF_GET_INODE_INFO(inode);
     55    struct dentry          *dentry     = VBSF_GET_F_DENTRY(file);
    5656    struct vbsf_dir_info   *sf_d;
    5757    int                     rc;
    5858
    5959    SFLOGFLOW(("vbsf_dir_open: inode=%p file=%p %s\n", inode, file, sf_i && sf_i->path ? sf_i->path->String.ach : NULL));
    60     AssertReturn(sf_g, -EINVAL);
     60    AssertReturn(pSuperInfo, -EINVAL);
    6161    AssertReturn(sf_i, -EINVAL);
    6262    AssertReturn(!file->private_data, 0);
     
    8888            LogFunc(("calling VbglR0SfHostReqCreate on folder %s, flags %#x\n",
    8989                     sf_i->path->String.utf8, pReq->CreateParms.CreateFlags));
    90             rc = VbglR0SfHostReqCreate(sf_g->map.root, pReq);
     90            rc = VbglR0SfHostReqCreate(pSuperInfo->map.root, pReq);
    9191            if (RT_SUCCESS(rc)) {
    9292                if (pReq->CreateParms.Result == SHFL_FILE_EXISTS) {
     
    9797                     * dentry cache chain that got us here.
    9898                     */
    99                     vbsf_update_inode(inode, sf_i, &pReq->CreateParms.Info, sf_g, true /*fLocked*/ /** @todo inode locking */);
     99                    vbsf_update_inode(inode, sf_i, &pReq->CreateParms.Info, pSuperInfo, true /*fLocked*/ /** @todo inode locking */);
    100100                    vbsf_dentry_chain_increase_ttl(dentry);
    101101
     
    154154
    155155    if (sf_d) {
    156         struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
     156        struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
    157157
    158158        /* Invalidate the non-handle part. */
     
    168168
    169169        /* Closes the handle and frees the structure when the last reference is released. */
    170         vbsf_handle_release(&sf_d->Handle, sf_g, "vbsf_dir_release");
     170        vbsf_handle_release(&sf_d->Handle, pSuperInfo, "vbsf_dir_release");
    171171    }
    172172
     
    201201 * @returns 0 on success, negative errno on error,
    202202 */
    203 static int vbsf_dir_read_more(struct vbsf_dir_info *sf_d, struct vbsf_super_info *sf_g, bool fRestart)
     203static int vbsf_dir_read_more(struct vbsf_dir_info *sf_d, struct vbsf_super_info *pSuperInfo, bool fRestart)
    204204{
    205205    int               rc;
     
    224224        /* Likely, except for the first time. */
    225225    } else {
    226         sf_d->pBuf = (PSHFLDIRINFO)kmalloc(sf_g->cbDirBuf, GFP_KERNEL);
     226        sf_d->pBuf = (PSHFLDIRINFO)kmalloc(pSuperInfo->cbDirBuf, GFP_KERNEL);
    227227        if (sf_d->pBuf)
    228             sf_d->cbBuf = sf_g->cbDirBuf;
     228            sf_d->cbBuf = pSuperInfo->cbDirBuf;
    229229        else {
    230230            sf_d->pBuf = (PSHFLDIRINFO)kmalloc(_4K, GFP_KERNEL);
     
    242242    pReq = (VBOXSFLISTDIRREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq));
    243243    if (pReq) {
    244         rc = VbglR0SfHostReqListDirContig2x(sf_g->map.root, pReq, sf_d->Handle.hHost, NULL, NIL_RTGCPHYS64,
     244        rc = VbglR0SfHostReqListDirContig2x(pSuperInfo->map.root, pReq, sf_d->Handle.hHost, NULL, NIL_RTGCPHYS64,
    245245                                            fRestart ? SHFL_LIST_RESTART : SHFL_LIST_NONE,
    246246                                            sf_d->pBuf, virt_to_phys(sf_d->pBuf), sf_d->cbBuf);
     
    285285# endif
    286286                                               const char *pszSrcName, uint16_t cchSrcName, ino_t d_ino, int d_type,
    287                                                struct vbsf_super_info *sf_g)
     287                                               struct vbsf_super_info *pSuperInfo)
    288288{
    289289    char szDstName[NAME_MAX];
    290     int rc = vbsf_nlscpy(sf_g, szDstName, sizeof(szDstName), pszSrcName, cchSrcName);
     290    int rc = vbsf_nlscpy(pSuperInfo, szDstName, sizeof(szDstName), pszSrcName, cchSrcName);
    291291    if (rc == 0) {
    292292#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
     
    337337    loff_t                  offPos = dir->f_pos;
    338338#endif
    339     struct vbsf_dir_info   *sf_d   = (struct vbsf_dir_info *)dir->private_data;
    340     struct vbsf_super_info *sf_g  = VBSF_GET_SUPER_INFO(VBSF_GET_F_DENTRY(dir)->d_sb);
     339    struct vbsf_dir_info   *sf_d       = (struct vbsf_dir_info *)dir->private_data;
     340    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(VBSF_GET_F_DENTRY(dir)->d_sb);
    341341    int                     rc;
    342342
     
    358358        loff_t offCurEntry = sf_d->offPos;
    359359        if (offPos < offCurEntry) {
    360             rc = vbsf_dir_read_more(sf_d, sf_g, true /*fRestart*/);
     360            rc = vbsf_dir_read_more(sf_d, pSuperInfo, true /*fRestart*/);
    361361            if (rc == 0)
    362362                offCurEntry = 0;
     
    375375                sf_d->offPos       = offCurEntry;
    376376                sf_d->cEntriesLeft = 0;
    377                 rc = vbsf_dir_read_more(sf_d, sf_g, false /*fRestart*/);
     377                rc = vbsf_dir_read_more(sf_d, pSuperInfo, false /*fRestart*/);
    378378                if (rc != 0 || sf_d->cEntriesLeft == 0) {
    379379                    up(&sf_d->Lock);
     
    459459        uint32_t cEntriesLeft = sf_d->cEntriesLeft;
    460460        if (!cEntriesLeft) {
    461             rc = vbsf_dir_read_more(sf_d, sf_g, false /*fRestart*/);
     461            rc = vbsf_dir_read_more(sf_d, pSuperInfo, false /*fRestart*/);
    462462            if (rc == 0) {
    463463                cEntriesLeft = sf_d->cEntriesLeft;
     
    504504                ino_t const d_ino  = (ino_t)offPos + 0xbeef; /* very fake */
    505505                bool        fContinue;
    506                 if (sf_g->fNlsIsUtf8) {
     506                if (pSuperInfo->fNlsIsUtf8) {
    507507#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
    508508                    fContinue = dir_emit(ctx, pEntry->name.String.ach, cchSrcName, d_ino, d_type);
     
    512512                } else {
    513513#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
    514                     fContinue = vbsf_dir_emit_nls(ctx, pEntry->name.String.ach, cchSrcName, d_ino, d_type, sf_g);
     514                    fContinue = vbsf_dir_emit_nls(ctx, pEntry->name.String.ach, cchSrcName, d_ino, d_type, pSuperInfo);
    515515#else
    516516                    fContinue = vbsf_dir_emit_nls(opaque, filldir, offPos, pEntry->name.String.ach, cchSrcName,
    517                                                   d_ino, d_type, sf_g);
     517                                                  d_ino, d_type, pSuperInfo);
    518518#endif
    519519                }
     
    579579 */
    580580static struct inode *vbsf_create_inode(struct inode *parent, struct dentry *dentry, PSHFLSTRING path,
    581                                        PSHFLFSOBJINFO pObjInfo, struct vbsf_super_info *sf_g, bool fInstantiate)
     581                                       PSHFLFSOBJINFO pObjInfo, struct vbsf_super_info *pSuperInfo, bool fInstantiate)
    582582{
    583583    /*
     
    606606
    607607            VBSF_SET_INODE_INFO(pInode, sf_new_i);
    608             vbsf_init_inode(pInode, sf_new_i, pObjInfo, sf_g);
     608            vbsf_init_inode(pInode, sf_new_i, pObjInfo, pSuperInfo);
    609609
    610610            /*
     
    657657                                        )
    658658{
    659     struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(parent->i_sb);
     659    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(parent->i_sb);
    660660    struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(parent);
    661661    SHFLSTRING             *path;
     
    671671#endif
    672672
    673     Assert(sf_g);
     673    Assert(pSuperInfo);
    674674    Assert(sf_i && sf_i->u32Magic == SF_INODE_INFO_MAGIC);
    675675
     
    677677     * Build the path.  We'll associate the path with dret's inode on success.
    678678     */
    679     rc = vbsf_path_from_dentry(sf_g, sf_i, dentry, &path, __func__);
     679    rc = vbsf_path_from_dentry(pSuperInfo, sf_i, dentry, &path, __func__);
    680680    if (rc == 0) {
    681681        /*
     
    692692
    693693            LogFunc(("Calling VbglR0SfHostReqCreate on %s\n", path->String.utf8));
    694             rc = VbglR0SfHostReqCreate(sf_g->map.root, pReq);
     694            rc = VbglR0SfHostReqCreate(pSuperInfo->map.root, pReq);
    695695            if (RT_SUCCESS(rc)) {
    696696                if (pReq->CreateParms.Result == SHFL_FILE_EXISTS) {
     
    699699                     * the existence of all parent dentries, we increase their TTL.
    700700                     */
    701                     pInode = vbsf_create_inode(parent, dentry, path, &pReq->CreateParms.Info, sf_g, false /*fInstantiate*/);
     701                    pInode = vbsf_create_inode(parent, dentry, path, &pReq->CreateParms.Info, pSuperInfo, false /*fInstantiate*/);
    702702                    if (rc == 0) {
    703703                        path = NULL; /* given to the inode */
     
    755755                                  PSHFLFSOBJINFO info, SHFLHANDLE handle)
    756756{
    757     struct vbsf_super_info *sf_g  = VBSF_GET_SUPER_INFO(parent->i_sb);
    758     struct inode           *pInode = vbsf_create_inode(parent, dentry, path, info, sf_g, true /*fInstantiate*/);
     757    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(parent->i_sb);
     758    struct inode           *pInode     = vbsf_create_inode(parent, dentry, path, info, pSuperInfo, true /*fInstantiate*/);
    759759    if (pInode) {
    760760        /* Store this handle if we leave the handle open. */
     
    791791#endif
    792792    struct vbsf_inode_info *sf_parent_i = VBSF_GET_INODE_INFO(parent);
    793     struct vbsf_super_info *sf_g        = VBSF_GET_SUPER_INFO(parent->i_sb);
     793    struct vbsf_super_info *pSuperInfo  = VBSF_GET_SUPER_INFO(parent->i_sb);
    794794    PSHFLSTRING             path;
    795795    int                     rc;
    796796
    797797    AssertReturn(sf_parent_i, -EINVAL);
    798     AssertReturn(sf_g, -EINVAL);
     798    AssertReturn(pSuperInfo, -EINVAL);
    799799
    800800    /*
    801801     * Build a path.  We'll donate this to the inode on success.
    802802     */
    803     rc = vbsf_path_from_dentry(sf_g, sf_parent_i, dentry, &path, __func__);
     803    rc = vbsf_path_from_dentry(pSuperInfo, sf_parent_i, dentry, &path, __func__);
    804804    if (rc == 0) {
    805805        /*
     
    822822
    823823            SFLOGFLOW(("%s calling VbglR0SfHostReqCreate(%s, %#x)\n", pszPrefix, path->String.ach, pReq->Create.CreateParms.CreateFlags));
    824             rc = VbglR0SfHostReqCreate(sf_g->map.root, &pReq->Create);
     824            rc = VbglR0SfHostReqCreate(pSuperInfo->map.root, &pReq->Create);
    825825            if (RT_SUCCESS(rc)) {
    826826                SFLOGFLOW(("%s VbglR0SfHostReqCreate returned %Rrc Result=%d Handle=%#llx\n",
     
    842842                 */
    843843                if (pReq->Create.CreateParms.Handle != SHFL_HANDLE_NIL) {
    844                     struct inode *pNewInode = vbsf_create_inode(parent, dentry, path, &pReq->Create.CreateParms.Info, sf_g,
     844                    struct inode *pNewInode = vbsf_create_inode(parent, dentry, path, &pReq->Create.CreateParms.Info, pSuperInfo,
    845845                                                                !fDoLookup /*fInstantiate*/);
    846846                    if (pNewInode) {
     
    868868                    if (fDoLookup) {
    869869                        struct inode *pNewInode = vbsf_create_inode(parent, dentry, path, &pReq->Create.CreateParms.Info,
    870                                                                     sf_g, false /*fInstantiate*/);
     870                                                                    pSuperInfo, false /*fInstantiate*/);
    871871                        if (pNewInode)
    872872                            vbsf_d_add_inode(dentry, pNewInode);
     
    893893            if (pReq->Create.CreateParms.Handle != SHFL_HANDLE_NIL) {
    894894                AssertCompile(RTASSERT_OFFSET_OF(VBOXSFCREATEREQ, CreateParms.Handle) > sizeof(VBOXSFCLOSEREQ)); /* no aliasing issues */
    895                 int rc2 = VbglR0SfHostReqClose(sf_g->map.root, &pReq->Close, pReq->Create.CreateParms.Handle);
     895                int rc2 = VbglR0SfHostReqClose(pSuperInfo->map.root, &pReq->Close, pReq->Create.CreateParms.Handle);
    896896                if (RT_FAILURE(rc2))
    897897                    SFLOGFLOW(("%s VbglR0SfHostReqCloseSimple failed rc=%Rrc\n", pszPrefix, rc2));
     
    989989                    sf_r = NULL; /* don't free it */
    990990                } else {
    991                     struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(pDirInode->i_sb);
     991                    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(pDirInode->i_sb);
    992992                    SFLOGFLOW(("vbsf_inode_atomic_open: finish_open failed: %d (path='%s'\n", rc, sf_i->path->String.ach));
    993                     VbglR0SfHostReqCloseSimple(sf_g->map.root, sf_r->Handle.hHost);
     993                    VbglR0SfHostReqCloseSimple(pSuperInfo->map.root, sf_r->Handle.hHost);
    994994                    sf_r->Handle.hHost = SHFL_HANDLE_NIL;
    995995                }
     
    10961096static int vbsf_unlink_worker(struct inode *parent, struct dentry *dentry, int fDirectory)
    10971097{
    1098     struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(parent->i_sb);
     1098    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(parent->i_sb);
    10991099    struct vbsf_inode_info *sf_parent_i = VBSF_GET_INODE_INFO(parent);
    11001100    SHFLSTRING *path;
     
    11031103    TRACE();
    11041104
    1105     rc = vbsf_path_from_dentry(sf_g, sf_parent_i, dentry, &path, __func__);
     1105    rc = vbsf_path_from_dentry(pSuperInfo, sf_parent_i, dentry, &path, __func__);
    11061106    if (!rc) {
    11071107        VBOXSFREMOVEREQ *pReq = (VBOXSFREMOVEREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFREMOVEREQ, StrPath.String)
     
    11131113                fFlags |= SHFL_REMOVE_SYMLINK;
    11141114
    1115             rc = VbglR0SfHostReqRemove(sf_g->map.root, pReq, fFlags);
     1115            rc = VbglR0SfHostReqRemove(pSuperInfo->map.root, pReq, fFlags);
    11161116
    11171117            if (dentry->d_inode) {
     
    11981198         * Check that they are on the same mount.
    11991199         */
    1200         struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(old_parent->i_sb);
    1201         if (sf_g == VBSF_GET_SUPER_INFO(new_parent->i_sb)) {
     1200        struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(old_parent->i_sb);
     1201        if (pSuperInfo == VBSF_GET_SUPER_INFO(new_parent->i_sb)) {
    12021202            /*
    12031203             * Build the new path.
     
    12051205            struct vbsf_inode_info *sf_new_parent_i = VBSF_GET_INODE_INFO(new_parent);
    12061206            PSHFLSTRING             pNewPath;
    1207             rc = vbsf_path_from_dentry(sf_g, sf_new_parent_i, new_dentry, &pNewPath, __func__);
     1207            rc = vbsf_path_from_dentry(pSuperInfo, sf_new_parent_i, new_dentry, &pNewPath, __func__);
    12081208            if (rc == 0) {
    12091209                /*
     
    12181218
    12191219                    memcpy(&pReq->StrDstPath, pNewPath, SHFLSTRING_HEADER_SIZE + pNewPath->u16Size);
    1220                     rc = VbglR0SfHostReqRenameWithSrcContig(sf_g->map.root, pReq, pOldPath, virt_to_phys(pOldPath), fRename);
     1220                    rc = VbglR0SfHostReqRenameWithSrcContig(pSuperInfo->map.root, pReq, pOldPath, virt_to_phys(pOldPath), fRename);
    12211221                    VbglR0PhysHeapFree(pReq);
    12221222                    if (RT_SUCCESS(rc)) {
     
    12571257        } else {
    12581258            SFLOGFLOW(("vbsf_inode_rename: rename with different roots (%#x vs %#x)\n",
    1259                        sf_g->map.root, VBSF_GET_SUPER_INFO(new_parent->i_sb)->map.root));
     1259                       pSuperInfo->map.root, VBSF_GET_SUPER_INFO(new_parent->i_sb)->map.root));
    12601260            rc = -EXDEV;
    12611261        }
     
    12941294    /** @todo we can save a kmalloc here if we switch to embedding the target rather
    12951295     * than the symlink path into the request.  Will require more NLS helpers. */
    1296     struct vbsf_super_info *sf_g    = VBSF_GET_SUPER_INFO(parent->i_sb);
    1297     PSHFLSTRING             pTarget = NULL;
    1298     int rc = vbsf_nls_to_shflstring(sf_g, target, &pTarget);
     1296    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(parent->i_sb);
     1297    PSHFLSTRING             pTarget    = NULL;
     1298    int rc = vbsf_nls_to_shflstring(pSuperInfo, target, &pTarget);
    12991299    if (rc == 0) {
    13001300        /*
     
    13031303        struct vbsf_inode_info *sf_i  = VBSF_GET_INODE_INFO(parent);
    13041304        PSHFLSTRING             pPath = NULL;
    1305         rc = vbsf_path_from_dentry(sf_g, sf_i, dentry, &pPath, __func__);
     1305        rc = vbsf_path_from_dentry(pSuperInfo, sf_i, dentry, &pPath, __func__);
    13061306        if (rc == 0) {
    13071307            /*
     
    13141314                memcpy(&pReq->StrSymlinkPath, pPath, SHFLSTRING_HEADER_SIZE + pPath->u16Size);
    13151315
    1316                 rc = VbglR0SfHostReqCreateSymlinkContig(sf_g->map.root, pTarget, virt_to_phys(pTarget), pReq);
     1316                rc = VbglR0SfHostReqCreateSymlinkContig(pSuperInfo->map.root, pTarget, virt_to_phys(pTarget), pReq);
    13171317                if (RT_SUCCESS(rc)) {
    13181318                    sf_i->force_restat = 1;
  • trunk/src/VBox/Additions/linux/sharedfolders/lnkops.c

    r77950 r77951  
    119119        pszTarget = (char *)kzalloc(PAGE_SIZE, GFP_KERNEL);
    120120        if (pszTarget) {
    121             struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    122             struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode);
    123             int rc = VbglR0SfHostReqReadLinkContigSimple(sf_g->map.root, sf_i->path->String.ach, sf_i->path->u16Length,
     121            struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
     122            struct vbsf_inode_info *sf_i       = VBSF_GET_INODE_INFO(inode);
     123            int rc = VbglR0SfHostReqReadLinkContigSimple(pSuperInfo->map.root, sf_i->path->String.ach, sf_i->path->u16Length,
    124124                                                         pszTarget, virt_to_phys(pszTarget), RT_MIN(PATH_MAX, PAGE_SIZE - 1));
    125125            if (RT_SUCCESS(rc)) {
    126126                pszTarget[PAGE_SIZE - 1] = '\0';
    127127                SFLOGFLOW(("vbsf_get_link: %s -> %s\n", sf_i->path->String.ach, pszTarget));
    128                 rc = vbsf_symlink_nls_convert(sf_g, pszTarget, PAGE_SIZE);
     128                rc = vbsf_symlink_nls_convert(pSuperInfo, pszTarget, PAGE_SIZE);
    129129                if (rc == 0) {
    130130                    vbsf_dentry_chain_increase_ttl(dentry);
     
    157157    if (pszTarget) {
    158158        struct inode           *inode = dentry->d_inode;
    159         struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    160         struct vbsf_inode_info *sf_i  = VBSF_GET_INODE_INFO(inode);
    161         rc = VbglR0SfHostReqReadLinkContigSimple(sf_g->map.root, sf_i->path->String.ach, sf_i->path->u16Length,
     159        struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
     160        struct vbsf_inode_info *sf_i       = VBSF_GET_INODE_INFO(inode);
     161        rc = VbglR0SfHostReqReadLinkContigSimple(pSuperInfo->map.root, sf_i->path->String.ach, sf_i->path->u16Length,
    162162                                                 pszTarget, virt_to_phys(pszTarget), RT_MIN(PATH_MAX, PAGE_SIZE - 1));
    163163        if (RT_SUCCESS(rc)) {
    164164            pszTarget[PAGE_SIZE - 1] = '\0';
    165165            SFLOGFLOW(("vbsf_readlink: %s -> %*s\n", sf_i->path->String.ach, pszTarget));
    166             rc = vbsf_symlink_nls_convert(sf_g, pszTarget, PAGE_SIZE);
     166            rc = vbsf_symlink_nls_convert(pSuperInfo, pszTarget, PAGE_SIZE);
    167167            if (rc == 0) {
    168168                vbsf_dentry_chain_increase_ttl(dentry);
     
    195195    if (pszTarget) {
    196196        struct inode           *inode = dentry->d_inode;
    197         struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    198         struct vbsf_inode_info *sf_i  = VBSF_GET_INODE_INFO(inode);
    199 
    200         rc = VbglR0SfHostReqReadLinkContigSimple(sf_g->map.root, sf_i->path->String.ach, sf_i->path->u16Length,
     197        struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
     198        struct vbsf_inode_info *sf_i       = VBSF_GET_INODE_INFO(inode);
     199
     200        rc = VbglR0SfHostReqReadLinkContigSimple(pSuperInfo->map.root, sf_i->path->String.ach, sf_i->path->u16Length,
    201201                                                 pszTarget, virt_to_phys(pszTarget), RT_MIN(PATH_MAX, PAGE_SIZE - 1));
    202202        if (RT_SUCCESS(rc)) {
    203203            pszTarget[PAGE_SIZE - 1] = '\0';
    204204            SFLOGFLOW(("vbsf_follow_link: %s -> %s\n", sf_i->path->String.ach, pszTarget));
    205             rc = vbsf_symlink_nls_convert(sf_g, pszTarget, PAGE_SIZE);
     205            rc = vbsf_symlink_nls_convert(pSuperInfo, pszTarget, PAGE_SIZE);
    206206            if (rc == 0) {
    207207                /*
  • trunk/src/VBox/Additions/linux/sharedfolders/regops.c

    r77949 r77951  
    447447 *
    448448 * @returns 0 (ref count).
    449  * @param   pHandle         The handle to release.
    450  * @param   sf_g            The info structure for the shared folder associated
    451  *                  with the handle.
    452  * @param   pszCaller       The caller name (for logging failures).
    453  */
    454 uint32_t vbsf_handle_release_slow(struct vbsf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller)
     449 * @param   pHandle     The handle to release.
     450 * @param   pSuperInfo  The info structure for the shared folder associated with
     451 *                      the handle.
     452 * @param   pszCaller   The caller name (for logging failures).
     453 */
     454uint32_t vbsf_handle_release_slow(struct vbsf_handle *pHandle, struct vbsf_super_info *pSuperInfo, const char *pszCaller)
    455455{
    456456    int rc;
     
    478478     * Actually destroy it.
    479479     */
    480     rc = VbglR0SfHostReqCloseSimple(sf_g->map.root, pHandle->hHost);
     480    rc = VbglR0SfHostReqCloseSimple(pSuperInfo->map.root, pHandle->hHost);
    481481    if (RT_FAILURE(rc))
    482482        LogFunc(("Caller %s: VbglR0SfHostReqCloseSimple %#RX64 failed with rc=%Rrc\n", pszCaller, pHandle->hHost, rc));
     
    537537 * already.
    538538 */
    539 DECLINLINE(bool) vbsf_should_use_cached_read(struct file *file, struct address_space *mapping, struct vbsf_super_info *sf_g)
     539DECLINLINE(bool) vbsf_should_use_cached_read(struct file *file, struct address_space *mapping, struct vbsf_super_info *pSuperInfo)
    540540{
    541541    return mapping
     
    543543        && mapping_writably_mapped(mapping)
    544544        && !(file->f_flags & O_DIRECT)
    545         && 1 /** @todo make this behaviour configurable at mount time (sf_g) */;
     545        && 1 /** @todo make this behaviour configurable at mount time (pSuperInfo) */;
    546546}
    547547
     
    757757static ssize_t vbsf_splice_read(struct file *file, loff_t *poffset, struct pipe_inode_info *pipe, size_t len, unsigned int flags)
    758758{
    759     struct inode           *inode = VBSF_GET_F_DENTRY(file)->d_inode;
    760     struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
     759    struct inode           *inode      = VBSF_GET_F_DENTRY(file)->d_inode;
     760    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
    761761    ssize_t                 cbRet;
    762762
    763763    SFLOGFLOW(("vbsf_splice_read: file=%p poffset=%p{%#RX64} pipe=%p len=%#zx flags=%#x\n", file, poffset, *poffset, pipe, len, flags));
    764     if (vbsf_should_use_cached_read(file, inode->i_mapping, sf_g)) {
     764    if (vbsf_should_use_cached_read(file, inode->i_mapping, pSuperInfo)) {
    765765        cbRet = generic_file_splice_read(file, poffset, pipe, len, flags);
    766766    } else {
     
    801801                uint32_t const          cbToRead = RT_MIN((cPages << PAGE_SHIFT) - (offFile & PAGE_OFFSET_MASK), len);
    802802                struct vbsf_reg_info   *sf_r     = (struct vbsf_reg_info *)file->private_data;
    803                 int vrc = VbglR0SfHostReqReadPgLst(sf_g->map.root, pReq, sf_r->Handle.hHost, offFile, cbToRead, cPages);
     803                int vrc = VbglR0SfHostReqReadPgLst(pSuperInfo->map.root, pReq, sf_r->Handle.hHost, offFile, cbToRead, cPages);
    804804                if (RT_SUCCESS(vrc)) {
    805805                    /*
     
    853853static ssize_t vbsf_splice_write(struct pipe_inode_info *pPipe, struct file *file, loff_t *poffset, size_t len, unsigned int flags)
    854854{
    855     struct inode           *inode = VBSF_GET_F_DENTRY(file)->d_inode;
    856     struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
     855    struct inode           *inode      = VBSF_GET_F_DENTRY(file)->d_inode;
     856    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
    857857    ssize_t                 cbRet;
    858858
     
    923923                       we'll only end up having to cancel the HGCM request 99% of the time: */
    924924                    if (!signal_pending(current))
    925                         vrc = VbglR0SfHostReqWritePgLst(sf_g->map.root, pReq, sf_r->Handle.hHost, offFile, cbToWrite, cPagesToWrite);
     925                        vrc = VbglR0SfHostReqWritePgLst(pSuperInfo->map.root, pReq, sf_r->Handle.hHost, offFile,
     926                                                        cbToWrite, cPagesToWrite);
    926927                    else
    927928                        vrc = VERR_INTERRUPTED;
     
    10501051                                )
    10511052{
    1052     struct inode           *inode = VBSF_GET_F_DENTRY(pFile)->d_inode;
    1053     struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
     1053    struct inode           *inode      = VBSF_GET_F_DENTRY(pFile)->d_inode;
     1054    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
    10541055    ssize_t                 cbRet;
    10551056    SFLOGFLOW(("vbsf_reg_sendfile: pFile=%p poffFile=%p{%#RX64} cbToSend=%#zx pfnActor=%p pvUser=%p\n",
    10561057               pFile, poffFile, poffFile ? *poffFile : 0, cbToSend, pfnActor, pvUser));
    1057     Assert(sf_g);
     1058    Assert(pSuperInfo);
    10581059
    10591060    /*
     
    10671068     * the page cache in some cases or configs.
    10681069     */
    1069     if (vbsf_should_use_cached_read(pFile, inode->i_mapping, sf_g)) {
     1070    if (vbsf_should_use_cached_read(pFile, inode->i_mapping, pSuperInfo)) {
    10701071        cbRet = generic_file_sendfile(pFile, poffFile, cbToSend, pfnActor, pvUser);
    10711072        SFLOGFLOW(("vbsf_reg_sendfile: returns %#zx *poffFile=%#RX64 [generic_file_sendfile]\n", cbRet, poffFile ? *poffFile : UINT64_MAX));
     
    11271128                    pReq->PgLst.offFirstPage = (uint16_t)offPg0;
    11281129                    if (!signal_pending(current))
    1129                         vrc = VbglR0SfHostReqReadPgLst(sf_g->map.root, pReq, sf_r->Handle.hHost, offFile, cbToRead, cPagesToRead);
     1130                        vrc = VbglR0SfHostReqReadPgLst(pSuperInfo->map.root, pReq, sf_r->Handle.hHost, offFile,
     1131                                                       cbToRead, cPagesToRead);
    11301132                    else
    11311133                        vrc = VERR_INTERRUPTED;
     
    14531455 */
    14541456static ssize_t vbsf_reg_read_locking(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off,
    1455                                      struct vbsf_super_info *sf_g, struct vbsf_reg_info *sf_r)
     1457                                     struct vbsf_super_info *pSuperInfo, struct vbsf_reg_info *sf_r)
    14561458{
    14571459    /*
     
    14681470    ssize_t             cbRet        = -ENOMEM;
    14691471    size_t              cPages       = (((uintptr_t)buf & PAGE_OFFSET_MASK) + size + PAGE_OFFSET_MASK) >> PAGE_SHIFT;
    1470     size_t              cMaxPages    = RT_MIN(RT_MAX(sf_g->cMaxIoPages, 1), cPages);
     1472    size_t              cMaxPages    = RT_MIN(RT_MAX(pSuperInfo->cMaxIoPages, 1), cPages);
    14711473    bool                fLockPgHack;
    14721474
     
    15081510             * Issue the request and unlock the pages.
    15091511             */
    1510             rc = VbglR0SfHostReqReadPgLst(sf_g->map.root, pReq, sf_r->Handle.hHost, offFile, cbChunk, cPages);
     1512            rc = VbglR0SfHostReqReadPgLst(pSuperInfo->map.root, pReq, sf_r->Handle.hHost, offFile, cbChunk, cPages);
    15111513
    15121514            vbsf_unlock_user_pages(papPages, cPages, true /*fSetDirty*/, fLockPgHack);
     
    15691571static ssize_t vbsf_reg_read(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off)
    15701572{
    1571     struct inode *inode = VBSF_GET_F_DENTRY(file)->d_inode;
    1572     struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    1573     struct vbsf_reg_info *sf_r = file->private_data;
    1574     struct address_space *mapping = inode->i_mapping;
     1573    struct inode            *inode    = VBSF_GET_F_DENTRY(file)->d_inode;
     1574    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
     1575    struct vbsf_reg_info   *sf_r      = file->private_data;
     1576    struct address_space   *mapping    = inode->i_mapping;
    15751577
    15761578    SFLOGFLOW(("vbsf_reg_read: inode=%p file=%p buf=%p size=%#zx off=%#llx\n", inode, file, buf, size, *off));
     
    15921594     * mappings around with any kind of pages loaded.
    15931595     */
    1594     if (vbsf_should_use_cached_read(file, mapping, sf_g))
     1596    if (vbsf_should_use_cached_read(file, mapping, pSuperInfo))
    15951597        return vbsf_reg_read_mapped(file, buf, size, off);
    15961598
     
    16051607            if ((PAGE_SIZE - ((uintptr_t)pReq & PAGE_OFFSET_MASK)) >= cbReq) {
    16061608                ssize_t cbRet;
    1607                 int vrc = VbglR0SfHostReqReadEmbedded(sf_g->map.root, pReq, sf_r->Handle.hHost, *off, (uint32_t)size);
     1609                int vrc = VbglR0SfHostReqReadEmbedded(pSuperInfo->map.root, pReq, sf_r->Handle.hHost, *off, (uint32_t)size);
    16081610                if (RT_SUCCESS(vrc)) {
    16091611                    cbRet = pReq->Parms.cb32Read.u.value32;
     
    16321634            if (pReq) {
    16331635                ssize_t cbRet;
    1634                 int vrc = VbglR0SfHostReqReadContig(sf_g->map.root, pReq, sf_r->Handle.hHost, *off,
     1636                int vrc = VbglR0SfHostReqReadContig(pSuperInfo->map.root, pReq, sf_r->Handle.hHost, *off,
    16351637                                                    (uint32_t)size, pvBounce, virt_to_phys(pvBounce));
    16361638                if (RT_SUCCESS(vrc)) {
     
    16521654#endif
    16531655
    1654     return vbsf_reg_read_locking(file, buf, size, off, sf_g, sf_r);
     1656    return vbsf_reg_read_locking(file, buf, size, off, pSuperInfo, sf_r);
    16551657}
    16561658
     
    17491751static ssize_t vbsf_reg_write_locking(struct file *file, const char /*__user*/ *buf, size_t size, loff_t *off, loff_t offFile,
    17501752                                      struct inode *inode, struct vbsf_inode_info *sf_i,
    1751                                       struct vbsf_super_info *sf_g, struct vbsf_reg_info *sf_r)
     1753                                      struct vbsf_super_info *pSuperInfo, struct vbsf_reg_info *sf_r)
    17521754{
    17531755    /*
     
    17631765    ssize_t              cbRet        = -ENOMEM;
    17641766    size_t               cPages       = (((uintptr_t)buf & PAGE_OFFSET_MASK) + size + PAGE_OFFSET_MASK) >> PAGE_SHIFT;
    1765     size_t               cMaxPages    = RT_MIN(RT_MAX(sf_g->cMaxIoPages, 1), cPages);
     1767    size_t               cMaxPages    = RT_MIN(RT_MAX(pSuperInfo->cMaxIoPages, 1), cPages);
    17661768    bool                 fLockPgHack;
    17671769
     
    18031805             * Issue the request and unlock the pages.
    18041806             */
    1805             rc = VbglR0SfHostReqWritePgLst(sf_g->map.root, pReq, sf_r->Handle.hHost, offFile, cbChunk, cPages);
     1807            rc = VbglR0SfHostReqWritePgLst(pSuperInfo->map.root, pReq, sf_r->Handle.hHost, offFile, cbChunk, cPages);
    18061808            if (RT_SUCCESS(rc)) {
    18071809                /*
     
    18721874static ssize_t vbsf_reg_write(struct file *file, const char *buf, size_t size, loff_t * off)
    18731875{
    1874     struct inode           *inode   = VBSF_GET_F_DENTRY(file)->d_inode;
    1875     struct vbsf_inode_info *sf_i    = VBSF_GET_INODE_INFO(inode);
    1876     struct vbsf_super_info *sf_g    = VBSF_GET_SUPER_INFO(inode->i_sb);
    1877     struct vbsf_reg_info   *sf_r    = file->private_data;
    1878     struct address_space   *mapping = inode->i_mapping;
     1876    struct inode           *inode      = VBSF_GET_F_DENTRY(file)->d_inode;
     1877    struct vbsf_inode_info *sf_i       = VBSF_GET_INODE_INFO(inode);
     1878    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
     1879    struct vbsf_reg_info   *sf_r       = file->private_data;
     1880    struct address_space   *mapping    = inode->i_mapping;
    18791881    loff_t                  pos;
    18801882
    18811883    SFLOGFLOW(("vbsf_reg_write: inode=%p file=%p buf=%p size=%#zx off=%#llx\n", inode, file, buf, size, *off));
    1882     BUG_ON(!sf_i);
    1883     BUG_ON(!sf_g);
    1884     BUG_ON(!sf_r);
     1884    Assert(sf_i);
     1885    Assert(pSuperInfo);
     1886    Assert(sf_r);
    18851887    AssertReturn(S_ISREG(inode->i_mode), -EINVAL);
    18861888
     
    19261928            ssize_t cbRet;
    19271929            if (copy_from_user(pReq->abData, buf, size) == 0) {
    1928                 int vrc = VbglR0SfHostReqWriteEmbedded(sf_g->map.root, pReq, sf_r->Handle.hHost,
     1930                int vrc = VbglR0SfHostReqWriteEmbedded(pSuperInfo->map.root, pReq, sf_r->Handle.hHost,
    19291931                                                       pos, (uint32_t)size);
    19301932                if (RT_SUCCESS(vrc)) {
     
    19611963                if (pReq) {
    19621964                    ssize_t cbRet;
    1963                     int vrc = VbglR0SfHostReqWriteContig(sf_g->map.root, pReq, sf_r->handle, pos,
     1965                    int vrc = VbglR0SfHostReqWriteContig(pSuperInfo->map.root, pReq, sf_r->handle, pos,
    19641966                                         (uint32_t)size, pvBounce, virt_to_phys(pvBounce));
    19651967                    if (RT_SUCCESS(vrc)) {
     
    19881990#endif
    19891991
    1990     return vbsf_reg_write_locking(file, buf, size, off, pos, inode, sf_i, sf_g, sf_r);
     1992    return vbsf_reg_write_locking(file, buf, size, off, pos, inode, sf_i, pSuperInfo, sf_r);
    19911993}
    19921994
     
    23592361 */
    23602362static ssize_t vbsf_reg_read_iter_locking(struct kiocb *kio, struct iov_iter *iter, size_t cbToRead,
    2361                                           struct vbsf_super_info *sf_g, struct vbsf_reg_info *sf_r)
     2363                                          struct vbsf_super_info *pSuperInfo, struct vbsf_reg_info *sf_r)
    23622364{
    23632365    /*
     
    23712373    ssize_t             cbRet        = 0;
    23722374    size_t              cMaxPages    = vbsf_iter_max_span_of_pages(iter);
    2373     cMaxPages = RT_MIN(RT_MAX(sf_g->cMaxIoPages, 2), cMaxPages);
     2375    cMaxPages = RT_MIN(RT_MAX(pSuperInfo->cMaxIoPages, 2), cMaxPages);
    23742376
    23752377    pReq = (VBOXSFREADPGLSTREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF_DYN(VBOXSFREADPGLSTREQ, PgLst.aPages[cMaxPages]));
     
    24102412             * Issue the request and unlock the pages.
    24112413             */
    2412             rc = VbglR0SfHostReqReadPgLst(sf_g->map.root, pReq, sf_r->Handle.hHost, kio->ki_pos, cbChunk, cPages);
     2414            rc = VbglR0SfHostReqReadPgLst(pSuperInfo->map.root, pReq, sf_r->Handle.hHost, kio->ki_pos, cbChunk, cPages);
    24132415            SFLOGFLOW(("vbsf_reg_read_iter_locking: VbglR0SfHostReqReadPgLst -> %d (cbActual=%#x cbChunk=%#zx of %#zx cPages=%#zx offPage0=%#x\n",
    24142416                       rc, pReq->Parms.cb32Read.u.value32, cbChunk, cbToRead, cPages, offPage0));
     
    24872489{
    24882490# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
    2489     struct vbsf_iov_iter    fake_iter = VBSF_IOV_ITER_INITIALIZER(cSegs, iov, 0 /*write*/);
    2490     struct vbsf_iov_iter   *iter      = &fake_iter;
    2491 # endif
    2492     size_t                  cbToRead = iov_iter_count(iter);
    2493     struct inode           *inode    = VBSF_GET_F_DENTRY(kio->ki_filp)->d_inode;
    2494     struct address_space   *mapping  = inode->i_mapping;
    2495 
    2496     struct vbsf_reg_info   *sf_r     = kio->ki_filp->private_data;
    2497     struct vbsf_super_info *sf_g    = VBSF_GET_SUPER_INFO(inode->i_sb);
     2491    struct vbsf_iov_iter    fake_iter  = VBSF_IOV_ITER_INITIALIZER(cSegs, iov, 0 /*write*/);
     2492    struct vbsf_iov_iter   *iter       = &fake_iter;
     2493# endif
     2494    size_t                  cbToRead   = iov_iter_count(iter);
     2495    struct inode           *inode      = VBSF_GET_F_DENTRY(kio->ki_filp)->d_inode;
     2496    struct address_space   *mapping    = inode->i_mapping;
     2497
     2498    struct vbsf_reg_info   *sf_r       = kio->ki_filp->private_data;
     2499    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
    24982500
    24992501    SFLOGFLOW(("vbsf_reg_read_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n",
     
    25132515     * mappings around with any kind of pages loaded.
    25142516     */
    2515     if (vbsf_should_use_cached_read(kio->ki_filp, mapping, sf_g)) {
     2517    if (vbsf_should_use_cached_read(kio->ki_filp, mapping, pSuperInfo)) {
    25162518# if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
    25172519        return generic_file_read_iter(kio, iter);
     
    25392541            if ((PAGE_SIZE - ((uintptr_t)pReq & PAGE_OFFSET_MASK)) >= cbReq) {
    25402542                ssize_t cbRet;
    2541                 int vrc = VbglR0SfHostReqReadEmbedded(sf_g->map.root, pReq, sf_r->Handle.hHost, kio->ki_pos, (uint32_t)cbToRead);
     2543                int vrc = VbglR0SfHostReqReadEmbedded(pSuperInfo->map.root, pReq, sf_r->Handle.hHost,
     2544                                                      kio->ki_pos, (uint32_t)cbToRead);
    25422545                if (RT_SUCCESS(vrc)) {
    25432546                    cbRet = pReq->Parms.cb32Read.u.value32;
     
    25622565     * Otherwise do the page locking thing.
    25632566     */
    2564     return vbsf_reg_read_iter_locking(kio, iter, cbToRead, sf_g, sf_r);
     2567    return vbsf_reg_read_iter_locking(kio, iter, cbToRead, pSuperInfo, sf_r);
    25652568}
    25662569
     
    25712574 */
    25722575static ssize_t vbsf_reg_write_iter_locking(struct kiocb *kio, struct iov_iter *iter, size_t cbToWrite, loff_t offFile,
    2573                                            struct vbsf_super_info *sf_g, struct vbsf_reg_info *sf_r,
     2576                                           struct vbsf_super_info *pSuperInfo, struct vbsf_reg_info *sf_r,
    25742577                                           struct inode *inode, struct vbsf_inode_info *sf_i, struct address_space *mapping)
    25752578{
     
    25842587    ssize_t              cbRet        = 0;
    25852588    size_t               cMaxPages    = vbsf_iter_max_span_of_pages(iter);
    2586     cMaxPages = RT_MIN(RT_MAX(sf_g->cMaxIoPages, 2), cMaxPages);
     2589    cMaxPages = RT_MIN(RT_MAX(pSuperInfo->cMaxIoPages, 2), cMaxPages);
    25872590
    25882591    pReq = (VBOXSFWRITEPGLSTREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF_DYN(VBOXSFWRITEPGLSTREQ, PgLst.aPages[cMaxPages]));
     
    26232626             * Issue the request and unlock the pages.
    26242627             */
    2625             rc = VbglR0SfHostReqWritePgLst(sf_g->map.root, pReq, sf_r->Handle.hHost, offFile, cbChunk, cPages);
     2628            rc = VbglR0SfHostReqWritePgLst(pSuperInfo->map.root, pReq, sf_r->Handle.hHost, offFile, cbChunk, cPages);
    26262629            SFLOGFLOW(("vbsf_reg_write_iter_locking: VbglR0SfHostReqWritePgLst -> %d (cbActual=%#x cbChunk=%#zx of %#zx cPages=%#zx offPage0=%#x\n",
    26272630                       rc, pReq->Parms.cb32Write.u.value32, cbChunk, cbToWrite, cPages, offPage0));
     
    27072710{
    27082711# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
    2709     struct vbsf_iov_iter    fake_iter = VBSF_IOV_ITER_INITIALIZER(cSegs, iov, 1 /*write*/);
    2710     struct vbsf_iov_iter   *iter      = &fake_iter;
    2711 # endif
    2712     size_t                  cbToWrite = iov_iter_count(iter);
    2713     struct inode           *inode     = VBSF_GET_F_DENTRY(kio->ki_filp)->d_inode;
    2714     struct vbsf_inode_info *sf_i      = VBSF_GET_INODE_INFO(inode);
    2715     struct address_space   *mapping   = inode->i_mapping;
    2716 
    2717     struct vbsf_reg_info   *sf_r      = kio->ki_filp->private_data;
    2718     struct vbsf_super_info *sf_g      = VBSF_GET_SUPER_INFO(inode->i_sb);
     2712    struct vbsf_iov_iter    fake_iter  = VBSF_IOV_ITER_INITIALIZER(cSegs, iov, 1 /*write*/);
     2713    struct vbsf_iov_iter   *iter       = &fake_iter;
     2714# endif
     2715    size_t                  cbToWrite  = iov_iter_count(iter);
     2716    struct inode           *inode      = VBSF_GET_F_DENTRY(kio->ki_filp)->d_inode;
     2717    struct vbsf_inode_info *sf_i       = VBSF_GET_INODE_INFO(inode);
     2718    struct address_space   *mapping    = inode->i_mapping;
     2719
     2720    struct vbsf_reg_info   *sf_r       = kio->ki_filp->private_data;
     2721    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
    27192722# if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
    2720     loff_t                  offFile   = kio->ki_pos;
     2723    loff_t                  offFile    = kio->ki_pos;
    27212724# endif
    27222725
     
    27782781                ssize_t cbRet;
    27792782                if (copy_from_iter(pReq->abData, cbToWrite, iter) == cbToWrite) {
    2780                     int vrc = VbglR0SfHostReqWriteEmbedded(sf_g->map.root, pReq, sf_r->Handle.hHost,
     2783                    int vrc = VbglR0SfHostReqWriteEmbedded(pSuperInfo->map.root, pReq, sf_r->Handle.hHost,
    27812784                                                           offFile, (uint32_t)cbToWrite);
    27822785                    if (RT_SUCCESS(vrc)) {
     
    28082811     * Otherwise do the page locking thing.
    28092812     */
    2810     return vbsf_reg_write_iter_locking(kio, iter, cbToWrite, offFile, sf_g, sf_r, inode, sf_i, mapping);
     2813    return vbsf_reg_write_iter_locking(kio, iter, cbToWrite, offFile, pSuperInfo, sf_r, inode, sf_i, mapping);
    28112814}
    28122815
     
    28982901{
    28992902    int rc, rc_linux = 0;
    2900     struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    2901     struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode);
    2902     struct dentry          *dentry = VBSF_GET_F_DENTRY(file);
     2903    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
     2904    struct vbsf_inode_info *sf_i       = VBSF_GET_INODE_INFO(inode);
     2905    struct dentry          *dentry     = VBSF_GET_F_DENTRY(file);
    29032906    struct vbsf_reg_info   *sf_r;
    29042907    VBOXSFCREATEREQ        *pReq;
    29052908
    29062909    SFLOGFLOW(("vbsf_reg_open: inode=%p file=%p flags=%#x %s\n", inode, file, file->f_flags, sf_i ? sf_i->path->String.ach : NULL));
    2907     BUG_ON(!sf_g);
    2908     BUG_ON(!sf_i);
     2910    Assert(pSuperInfo);
     2911    Assert(sf_i);
    29092912
    29102913    sf_r = kmalloc(sizeof(*sf_r), GFP_KERNEL);
     
    29602963    LogFunc(("vbsf_reg_open: calling VbglR0SfHostReqCreate, file %s, flags=%#x, %#x\n",
    29612964             sf_i->path->String.utf8, file->f_flags, pReq->CreateParms.CreateFlags));
    2962     rc = VbglR0SfHostReqCreate(sf_g->map.root, pReq);
     2965    rc = VbglR0SfHostReqCreate(pSuperInfo->map.root, pReq);
    29632966    if (RT_FAILURE(rc)) {
    29642967        LogFunc(("VbglR0SfHostReqCreate failed flags=%d,%#x rc=%Rrc\n", file->f_flags, pReq->CreateParms.CreateFlags, rc));
     
    30153018    SFLOGFLOW(("vbsf_reg_release: inode=%p file=%p\n", inode, file));
    30163019    if (sf_r) {
    3017         struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    3018         Assert(sf_g);
     3020        struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
     3021        Assert(pSuperInfo);
    30193022
    30203023#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25)
     
    30313034        /* Release sf_r, closing the handle if we're the last user. */
    30323035        file->private_data = NULL;
    3033         vbsf_handle_release(&sf_r->Handle, sf_g, "vbsf_reg_release");
     3036        vbsf_handle_release(&sf_r->Handle, pSuperInfo, "vbsf_reg_release");
    30343037
    30353038        sf_i->handle = SHFL_HANDLE_NIL;
     
    34563459        VBOXSFREADPGLSTREQ *pReq = (VBOXSFREADPGLSTREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq));
    34573460        if (pReq) {
    3458             struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    3459             struct vbsf_reg_info   *sf_r = file->private_data;
     3461            struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
     3462            struct vbsf_reg_info   *sf_r       = file->private_data;
    34603463            uint32_t                cbRead;
    34613464            int                     vrc;
     
    34633466            pReq->PgLst.offFirstPage = 0;
    34643467            pReq->PgLst.aPages[0]    = page_to_phys(page);
    3465             vrc = VbglR0SfHostReqReadPgLst(sf_g->map.root,
     3468            vrc = VbglR0SfHostReqReadPgLst(pSuperInfo->map.root,
    34663469                                           pReq,
    34673470                                           sf_r->Handle.hHost,
     
    35183521
    35193522    if (pHandle) {
    3520         struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    3521         VBOXSFWRITEPGLSTREQ    *pReq = (VBOXSFWRITEPGLSTREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq));
     3523        struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
     3524        VBOXSFWRITEPGLSTREQ    *pReq       = (VBOXSFWRITEPGLSTREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq));
    35223525        if (pReq) {
    3523             uint64_t const cbFile    = i_size_read(inode);
    3524             uint64_t const offInFile = (uint64_t)page->index << PAGE_SHIFT;
    3525             uint32_t const cbToWrite = page->index != (cbFile >> PAGE_SHIFT) ? PAGE_SIZE
    3526                                      : (uint32_t)cbFile & (uint32_t)PAGE_OFFSET_MASK;
     3526            uint64_t const cbFile          = i_size_read(inode);
     3527            uint64_t const offInFile       = (uint64_t)page->index << PAGE_SHIFT;
     3528            uint32_t const cbToWrite       = page->index != (cbFile >> PAGE_SHIFT) ? PAGE_SIZE
     3529                                           : (uint32_t)cbFile & (uint32_t)PAGE_OFFSET_MASK;
    35273530            int            vrc;
    35283531
    35293532            pReq->PgLst.offFirstPage = 0;
    35303533            pReq->PgLst.aPages[0]    = page_to_phys(page);
    3531             vrc = VbglR0SfHostReqWritePgLst(sf_g->map.root,
     3534            vrc = VbglR0SfHostReqWritePgLst(pSuperInfo->map.root,
    35323535                                            pReq,
    35333536                                            pHandle->hHost,
     
    35583561        } else
    35593562            err = -ENOMEM;
    3560         vbsf_handle_release(pHandle, sf_g, "vbsf_writepage");
     3563        vbsf_handle_release(pHandle, pSuperInfo, "vbsf_writepage");
    35613564    } else {
    35623565        static uint64_t volatile s_cCalls = 0;
  • trunk/src/VBox/Additions/linux/sharedfolders/utils.c

    r77858 r77951  
    3737
    3838
    39 int vbsf_nlscpy(struct vbsf_super_info *sf_g, char *name, size_t name_bound_len, const unsigned char *utf8_name, size_t utf8_len)
     39int vbsf_nlscpy(struct vbsf_super_info *pSuperInfo, char *name, size_t name_bound_len,
     40                const unsigned char *utf8_name, size_t utf8_len)
    4041{
    4142    Assert(name_bound_len > 1);
    4243    Assert(RTStrNLen(utf8_name, utf8_len) == utf8_len);
    4344
    44     if (sf_g->nls) {
     45    if (pSuperInfo->nls) {
    4546        const char *in              = utf8_name;
    4647        size_t      in_bound_len    = utf8_len;
     
    5859#endif
    5960            if (cbInEnc >= 0) {
    60                 int cbOutEnc = sf_g->nls->uni2char(uni, out, out_bound_len);
     61                int cbOutEnc = pSuperInfo->nls->uni2char(uni, out, out_bound_len);
    6162                if (cbOutEnc >= 0) {
    6263                    /*SFLOG3(("vbsf_nlscpy: cbOutEnc=%d cbInEnc=%d uni=%#x in_bound_len=%u\n", cbOutEnc, cbInEnc, uni, in_bound_len));*/
     
    9495 * the output buffer (use kfree on result).
    9596 */
    96 int vbsf_nls_to_shflstring(struct vbsf_super_info *sf_g, const char *pszNls, PSHFLSTRING *ppString)
     97int vbsf_nls_to_shflstring(struct vbsf_super_info *pSuperInfo, const char *pszNls, PSHFLSTRING *ppString)
    9798{
    9899    int          rc;
    99100    size_t const cchNls = strlen(pszNls);
    100101    PSHFLSTRING  pString = NULL;
    101     if (sf_g->nls) {
     102    if (pSuperInfo->nls) {
    102103        /*
    103104         * NLS -> UTF-8 w/ SHLF string header.
     
    108109        while (offNls < cchNls) {
    109110            linux_wchar_t uc; /* Note! We renamed the type due to clashes. */
    110             int const cbNlsCodepoint = sf_g->nls->char2uni(&pszNls[offNls], cchNls - offNls, &uc);
     111            int const cbNlsCodepoint = pSuperInfo->nls->char2uni(&pszNls[offNls], cchNls - offNls, &uc);
    111112            if (cbNlsCodepoint >= 0) {
    112113                char achTmp[16];
     
    142143                while (offNls < cchNls) {
    143144                    linux_wchar_t uc; /* Note! We renamed the type due to clashes. */
    144                     int const cbNlsCodepoint = sf_g->nls->char2uni(&pszNls[offNls], cchNls - offNls, &uc);
     145                    int const cbNlsCodepoint = pSuperInfo->nls->char2uni(&pszNls[offNls], cchNls - offNls, &uc);
    145146                    if (cbNlsCodepoint >= 0) {
    146147#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
     
    293294
    294295/**
    295  * Initializes the @a inode attributes based on @a pObjInfo and @a sf_g options.
    296  */
    297 void vbsf_init_inode(struct inode *inode, struct vbsf_inode_info *sf_i, PSHFLFSOBJINFO pObjInfo, struct vbsf_super_info *sf_g)
     296 * Initializes the @a inode attributes based on @a pObjInfo and @a pSuperInfo
     297 * options.
     298 */
     299void vbsf_init_inode(struct inode *inode, struct vbsf_inode_info *sf_i, PSHFLFSOBJINFO pObjInfo,
     300                     struct vbsf_super_info *pSuperInfo)
    298301{
    299302    PCSHFLFSOBJATTR pAttr = &pObjInfo->Attr;
     
    307310    inode->i_mapping->a_ops = &vbsf_reg_aops;
    308311# if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 19, 0)
    309     inode->i_mapping->backing_dev_info = &sf_g->bdi; /* This is needed for mmap. */
     312    inode->i_mapping->backing_dev_info = &pSuperInfo->bdi; /* This is needed for mmap. */
    310313# endif
    311314#endif
    312315    if (RTFS_IS_DIRECTORY(pAttr->fMode)) {
    313         inode->i_mode = sf_file_mode_to_linux(pAttr->fMode, sf_g->dmode, sf_g->dmask, S_IFDIR);
     316        inode->i_mode = sf_file_mode_to_linux(pAttr->fMode, pSuperInfo->dmode, pSuperInfo->dmask, S_IFDIR);
    314317        inode->i_op = &vbsf_dir_iops;
    315318        inode->i_fop = &vbsf_dir_fops;
     
    322325        /** @todo r=bird: Aren't System V symlinks w/o any mode mask? IIRC there is
    323326         *        no lchmod on Linux. */
    324         inode->i_mode = sf_file_mode_to_linux(pAttr->fMode, sf_g->fmode, sf_g->fmask, S_IFLNK);
     327        inode->i_mode = sf_file_mode_to_linux(pAttr->fMode, pSuperInfo->fmode, pSuperInfo->fmask, S_IFLNK);
    325328        inode->i_op = &vbsf_lnk_iops;
    326329        set_nlink(inode, 1);
    327330    } else {
    328         inode->i_mode = sf_file_mode_to_linux(pAttr->fMode, sf_g->fmode, sf_g->fmask, S_IFREG);
     331        inode->i_mode = sf_file_mode_to_linux(pAttr->fMode, pSuperInfo->fmode, pSuperInfo->fmask, S_IFREG);
    329332        inode->i_op = &vbsf_reg_iops;
    330333        inode->i_fop = &vbsf_reg_fops;
     
    333336
    334337#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
    335     inode->i_uid = make_kuid(current_user_ns(), sf_g->uid);
    336     inode->i_gid = make_kgid(current_user_ns(), sf_g->gid);
     338    inode->i_uid = make_kuid(current_user_ns(), pSuperInfo->uid);
     339    inode->i_gid = make_kgid(current_user_ns(), pSuperInfo->gid);
    337340#else
    338     inode->i_uid = sf_g->uid;
    339     inode->i_gid = sf_g->gid;
     341    inode->i_uid = pSuperInfo->uid;
     342    inode->i_gid = pSuperInfo->gid;
    340343#endif
    341344
     
    363366 */
    364367void vbsf_update_inode(struct inode *pInode, struct vbsf_inode_info *pInodeInfo, PSHFLFSOBJINFO pObjInfo,
    365                        struct vbsf_super_info *sf_g, bool fInodeLocked)
     368                       struct vbsf_super_info *pSuperInfo, bool fInodeLocked)
    366369{
    367370    PCSHFLFSOBJATTR pAttr = &pObjInfo->Attr;
     
    379382     */
    380383    if (RTFS_IS_DIRECTORY(pAttr->fMode))
    381         fMode = sf_file_mode_to_linux(pAttr->fMode, sf_g->dmode, sf_g->dmask, S_IFDIR);
     384        fMode = sf_file_mode_to_linux(pAttr->fMode, pSuperInfo->dmode, pSuperInfo->dmask, S_IFDIR);
    382385    else if (RTFS_IS_SYMLINK(pAttr->fMode))
    383386        /** @todo r=bird: Aren't System V symlinks w/o any mode mask? IIRC there is
    384387         *        no lchmod on Linux. */
    385         fMode = sf_file_mode_to_linux(pAttr->fMode, sf_g->fmode, sf_g->fmask, S_IFLNK);
     388        fMode = sf_file_mode_to_linux(pAttr->fMode, pSuperInfo->fmode, pSuperInfo->fmask, S_IFLNK);
    386389    else
    387         fMode = sf_file_mode_to_linux(pAttr->fMode, sf_g->fmode, sf_g->fmask, S_IFREG);
     390        fMode = sf_file_mode_to_linux(pAttr->fMode, pSuperInfo->fmode, pSuperInfo->fmask, S_IFREG);
    388391
    389392    if (fMode == pInode->i_mode) {
     
    396399                       pInode->i_mode & S_IFMT, fMode & S_IFMT, pInodeInfo->path->String.ach));
    397400            /** @todo we probably need to be more drastic... */
    398             vbsf_init_inode(pInode, pInodeInfo, pObjInfo, sf_g);
     401            vbsf_init_inode(pInode, pInodeInfo, pObjInfo, pSuperInfo);
    399402
    400403#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
     
    435438
    436439/** @note Currently only used for the root directory during (re-)mount.  */
    437 int vbsf_stat(const char *caller, struct vbsf_super_info *sf_g, SHFLSTRING *path, PSHFLFSOBJINFO result, int ok_to_fail)
     440int vbsf_stat(const char *caller, struct vbsf_super_info *pSuperInfo, SHFLSTRING *path, PSHFLFSOBJINFO result, int ok_to_fail)
    438441{
    439442    int rc;
     
    451454
    452455        LogFunc(("Calling VbglR0SfHostReqCreate on %s\n", path->String.utf8));
    453         rc = VbglR0SfHostReqCreate(sf_g->map.root, pReq);
     456        rc = VbglR0SfHostReqCreate(pSuperInfo->map.root, pReq);
    454457        if (RT_SUCCESS(rc)) {
    455458            if (pReq->CreateParms.Result == SHFL_FILE_EXISTS) {
     
    486489    struct inode *pInode = dentry ? dentry->d_inode : NULL;
    487490    if (pInode) {
    488         struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(pInode);
    489         struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(pInode->i_sb);
     491        struct vbsf_inode_info *sf_i       = VBSF_GET_INODE_INFO(pInode);
     492        struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(pInode->i_sb);
    490493        AssertReturn(sf_i, -EINVAL);
    491         AssertReturn(sf_g, -EINVAL);
     494        AssertReturn(pSuperInfo, -EINVAL);
    492495
    493496        /*
     
    496499        if (   !fForced
    497500            && !sf_i->force_restat
    498             && jiffies - sf_i->ts_up_to_date < sf_g->ttl)
     501            && jiffies - sf_i->ts_up_to_date < pSuperInfo->ttl)
    499502            rc = 0;
    500503        else {
     
    509512                if (pReq) {
    510513                    RT_ZERO(*pReq);
    511                     rc = VbglR0SfHostReqQueryObjInfo(sf_g->map.root, pReq, pHandle->hHost);
     514                    rc = VbglR0SfHostReqQueryObjInfo(pSuperInfo->map.root, pReq, pHandle->hHost);
    512515                    if (RT_SUCCESS(rc)) {
    513516                        /*
    514517                         * Reset the TTL and copy the info over into the inode structure.
    515518                         */
    516                         vbsf_update_inode(pInode, sf_i, &pReq->ObjInfo, sf_g, fInodeLocked);
     519                        vbsf_update_inode(pInode, sf_i, &pReq->ObjInfo, pSuperInfo, fInodeLocked);
    517520                    } else if (rc == VERR_INVALID_HANDLE) {
    518521                        rc = -ENOENT; /* Restore.*/
     
    524527                } else
    525528                    rc = -ENOMEM;
    526                 vbsf_handle_release(pHandle, sf_g, "vbsf_inode_revalidate_worker");
     529                vbsf_handle_release(pHandle, pSuperInfo, "vbsf_inode_revalidate_worker");
    527530
    528531            } else {
     
    536539                    pReq->CreateParms.CreateFlags = SHFL_CF_LOOKUP | SHFL_CF_ACT_FAIL_IF_NEW;
    537540
    538                     rc = VbglR0SfHostReqCreate(sf_g->map.root, pReq);
     541                    rc = VbglR0SfHostReqCreate(pSuperInfo->map.root, pReq);
    539542                    if (RT_SUCCESS(rc)) {
    540543                        if (pReq->CreateParms.Result == SHFL_FILE_EXISTS) {
     
    542545                             * Reset the TTL and copy the info over into the inode structure.
    543546                             */
    544                             vbsf_update_inode(pInode, sf_i, &pReq->CreateParms.Info, sf_g, fInodeLocked);
     547                            vbsf_update_inode(pInode, sf_i, &pReq->CreateParms.Info, pSuperInfo, fInodeLocked);
    545548                            rc = 0;
    546549                        } else {
     
    598601        err = -EINVAL;
    599602    } else {
    600         struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(pInode);
    601         struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(pInode->i_sb);
     603        struct vbsf_inode_info *sf_i       = VBSF_GET_INODE_INFO(pInode);
     604        struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(pInode->i_sb);
    602605        AssertReturn(sf_i, -EINVAL);
    603         AssertReturn(sf_g, -EINVAL);
     606        AssertReturn(pSuperInfo, -EINVAL);
    604607
    605608        /*
     
    608611        if (   !fForced
    609612            && !sf_i->force_restat
    610             && jiffies - sf_i->ts_up_to_date < sf_g->ttl)
     613            && jiffies - sf_i->ts_up_to_date < pSuperInfo->ttl)
    611614            err = 0;
    612615        else {
     
    617620            if (pReq) {
    618621                RT_ZERO(*pReq);
    619                 err = VbglR0SfHostReqQueryObjInfo(sf_g->map.root, pReq, hHostFile);
     622                err = VbglR0SfHostReqQueryObjInfo(pSuperInfo->map.root, pReq, hHostFile);
    620623                if (RT_SUCCESS(err)) {
    621624                    /*
    622625                     * Reset the TTL and copy the info over into the inode structure.
    623626                     */
    624                     vbsf_update_inode(pInode, sf_i, &pReq->ObjInfo, sf_g, fInodeLocked);
     627                    vbsf_update_inode(pInode, sf_i, &pReq->ObjInfo, pSuperInfo, fInodeLocked);
    625628                } else {
    626629                    LogFunc(("VbglR0SfHostReqQueryObjInfo failed on %#RX64: %Rrc\n", hHostFile, err));
     
    730733int vbsf_inode_setattr(struct dentry *dentry, struct iattr *iattr)
    731734{
    732     struct inode           *pInode = dentry->d_inode;
    733     struct vbsf_super_info *sf_g  = VBSF_GET_SUPER_INFO(pInode->i_sb);
    734     struct vbsf_inode_info *sf_i   = VBSF_GET_INODE_INFO(pInode);
     735    struct inode           *pInode     = dentry->d_inode;
     736    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(pInode->i_sb);
     737    struct vbsf_inode_info *sf_i       = VBSF_GET_INODE_INFO(pInode);
    735738    int vrc;
    736739    int rc;
     
    791794                        pReq->Create.CreateParms.CreateFlags |= SHFL_CF_ACCESS_WRITE;
    792795                    memcpy(&pReq->Create.StrPath, sf_i->path, SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size);
    793                     vrc = VbglR0SfHostReqCreate(sf_g->map.root, &pReq->Create);
     796                    vrc = VbglR0SfHostReqCreate(pSuperInfo->map.root, &pReq->Create);
    794797                    if (RT_SUCCESS(vrc)) {
    795798                        if (pReq->Create.CreateParms.Result == SHFL_FILE_EXISTS) {
     
    835838
    836839                    /* Make the change. */
    837                     vrc = VbglR0SfHostReqSetObjInfo(sf_g->map.root, &pReq->Info, hHostFile);
     840                    vrc = VbglR0SfHostReqSetObjInfo(pSuperInfo->map.root, &pReq->Info, hHostFile);
    838841                    if (RT_SUCCESS(vrc)) {
    839                         vbsf_update_inode(pInode, sf_i, &pReq->Info.ObjInfo, sf_g, true /*fLocked*/);
     842                        vbsf_update_inode(pInode, sf_i, &pReq->Info.ObjInfo, pSuperInfo, true /*fLocked*/);
    840843                    } else {
    841844                        rc = -RTErrConvertToErrno(vrc);
     
    850853                 */
    851854                if ((iattr->ia_valid & ATTR_SIZE) && rc == 0) {
    852                     /*vrc = VbglR0SfHostReqSetFileSize(sf_g->map.root, &pReq->SetSize, hHostFile, iattr->ia_size);
     855                    /*vrc = VbglR0SfHostReqSetFileSize(pSuperInfo->map.root, &pReq->SetSize, hHostFile, iattr->ia_size);
    853856                    if (RT_SUCCESS(vrc)) {
    854857                        i_size_write(pInode, iattr->ia_size);
     
    857860                        RT_ZERO(pReq->Info.ObjInfo);
    858861                        pReq->Info.ObjInfo.cbObject = iattr->ia_size;
    859                         vrc = VbglR0SfHostReqSetFileSizeOld(sf_g->map.root, &pReq->Info, hHostFile);
     862                        vrc = VbglR0SfHostReqSetFileSizeOld(pSuperInfo->map.root, &pReq->Info, hHostFile);
    860863                        if (RT_SUCCESS(vrc))
    861                             vbsf_update_inode(pInode, sf_i, &pReq->Info.ObjInfo, sf_g, true /*fLocked*/);
     864                            vbsf_update_inode(pInode, sf_i, &pReq->Info.ObjInfo, pSuperInfo, true /*fLocked*/);
    862865                    }
    863866                    if (RT_SUCCESS(vrc)) {
     
    875878                 */
    876879                if (!pHandle) {
    877                     vrc = VbglR0SfHostReqClose(sf_g->map.root, &pReq->Close, hHostFile);
     880                    vrc = VbglR0SfHostReqClose(pSuperInfo->map.root, &pReq->Close, hHostFile);
    878881                    if (RT_FAILURE(vrc))
    879882                        LogFunc(("VbglR0SfHostReqClose(%s [%#llx]) failed vrc=%Rrc\n", sf_i->path->String.utf8, hHostFile, vrc));
     
    883886                VbglR0PhysHeapFree(pReq);
    884887            if (pHandle)
    885                 vbsf_handle_release(pHandle, sf_g, "vbsf_inode_setattr");
     888                vbsf_handle_release(pHandle, pSuperInfo, "vbsf_inode_setattr");
    886889        } else
    887890            SFLOGFLOW(("vbsf_inode_setattr: Notthing to do here (%#x).\n", iattr->ia_valid));
     
    942945/**
    943946 * [dentry] contains string encoded in coding system that corresponds
    944  * to [sf_g]->nls, we must convert it to UTF8 here and pass down to
     947 * to [pSuperInfo]->nls, we must convert it to UTF8 here and pass down to
    945948 * [vbsf_make_path] which will allocate SHFLSTRING and fill it in
    946949 */
    947 int vbsf_path_from_dentry(struct vbsf_super_info *sf_g, struct vbsf_inode_info *sf_i, struct dentry *dentry, SHFLSTRING **result,
    948                           const char *caller)
     950int vbsf_path_from_dentry(struct vbsf_super_info *pSuperInfo, struct vbsf_inode_info *sf_i, struct dentry *dentry,
     951                          SHFLSTRING **result, const char *caller)
    949952{
    950953    int err;
     
    958961    d_len = dentry->d_name.len;
    959962
    960     if (sf_g->nls) {
     963    if (pSuperInfo->nls) {
    961964        size_t in_len, i, out_bound_len;
    962965        const char *in;
     
    976979            int nb;
    977980
    978             nb = sf_g->nls->char2uni(in, in_len, &uni);
     981            nb = pSuperInfo->nls->char2uni(in, in_len, &uni);
    979982            if (nb < 0) {
    980983                LogFunc(("nls->char2uni failed %x %d\n",
     
    10801083            //struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(pInode);
    10811084            unsigned long const     cJiffiesAge = jiffies - vbsf_dentry_get_update_jiffies(dentry);
    1082             struct vbsf_super_info *sf_g        = VBSF_GET_SUPER_INFO(dentry->d_sb);
    1083             if (cJiffiesAge < sf_g->ttl) {
    1084                 SFLOGFLOW(("vbsf_dentry_revalidate: age: %lu vs. TTL %lu -> 1\n", cJiffiesAge, sf_g->ttl));
     1085            struct vbsf_super_info *pSuperInfo  = VBSF_GET_SUPER_INFO(dentry->d_sb);
     1086            if (cJiffiesAge < pSuperInfo->ttl) {
     1087                SFLOGFLOW(("vbsf_dentry_revalidate: age: %lu vs. TTL %lu -> 1\n", cJiffiesAge, pSuperInfo->ttl));
    10851088                rc = 1;
    10861089            } else if (!vbsf_inode_revalidate_worker(dentry, true /*fForced*/, false /*fInodeLocked*/)) {
    10871090                vbsf_dentry_set_update_jiffies(dentry, jiffies); /** @todo get jiffies from inode. */
    1088                 SFLOGFLOW(("vbsf_dentry_revalidate: age: %lu vs. TTL %lu -> reval -> 1\n", cJiffiesAge, sf_g->ttl));
     1091                SFLOGFLOW(("vbsf_dentry_revalidate: age: %lu vs. TTL %lu -> reval -> 1\n", cJiffiesAge, pSuperInfo->ttl));
    10891092                rc = 1;
    10901093            } else {
    1091                 SFLOGFLOW(("vbsf_dentry_revalidate: age: %lu vs. TTL %lu -> reval -> 0\n", cJiffiesAge, sf_g->ttl));
     1094                SFLOGFLOW(("vbsf_dentry_revalidate: age: %lu vs. TTL %lu -> reval -> 0\n", cJiffiesAge, pSuperInfo->ttl));
    10921095                rc = 0;
    10931096            }
     
    11141117                /* Can we skip revalidation based on TTL? */
    11151118                unsigned long const     cJiffiesAge = vbsf_dentry_get_update_jiffies(dentry) - jiffies;
    1116                 struct vbsf_super_info *sf_g        = VBSF_GET_SUPER_INFO(dentry->d_sb);
    1117                 if (cJiffiesAge < sf_g->ttl) {
    1118                     SFLOGFLOW(("vbsf_dentry_revalidate: negative: age: %lu vs. TTL %lu -> 1\n", cJiffiesAge, sf_g->ttl));
     1119                struct vbsf_super_info *pSuperInfo  = VBSF_GET_SUPER_INFO(dentry->d_sb);
     1120                if (cJiffiesAge < pSuperInfo->ttl) {
     1121                    SFLOGFLOW(("vbsf_dentry_revalidate: negative: age: %lu vs. TTL %lu -> 1\n", cJiffiesAge, pSuperInfo->ttl));
    11191122                    rc = 1;
    11201123                } else {
     
    11221125                       have the caller kick it out. */
    11231126                    /** @todo stat the direntry and see if it exists now. */
    1124                     SFLOGFLOW(("vbsf_dentry_revalidate: negative: age: %lu vs. TTL %lu -> 0\n", cJiffiesAge, sf_g->ttl));
     1127                    SFLOGFLOW(("vbsf_dentry_revalidate: negative: age: %lu vs. TTL %lu -> 0\n", cJiffiesAge, pSuperInfo->ttl));
    11251128                    rc = 0;
    11261129                }
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c

    r77863 r77951  
    8080
    8181/**
    82  * Copies options from the mount info structure into @a sf_g.
     82 * Copies options from the mount info structure into @a pSuperInfo.
    8383 *
    8484 * This is used both by vbsf_super_info_alloc_and_map_it() and
    8585 * vbsf_remount_fs().
    8686 */
    87 static void vbsf_super_info_copy_remount_options(struct vbsf_super_info *sf_g, struct vbsf_mount_info_new *info)
    88 {
    89     sf_g->ttl_msec = info->ttl;
     87static void vbsf_super_info_copy_remount_options(struct vbsf_super_info *pSuperInfo, struct vbsf_mount_info_new *info)
     88{
     89    pSuperInfo->ttl_msec = info->ttl;
    9090    if (info->ttl > 0)
    91         sf_g->ttl = msecs_to_jiffies(info->ttl);
     91        pSuperInfo->ttl = msecs_to_jiffies(info->ttl);
    9292    else if (info->ttl == 0 || info->ttl != -1)
    93         sf_g->ttl = sf_g->ttl_msec = 0;
     93        pSuperInfo->ttl = pSuperInfo->ttl_msec = 0;
    9494    else
    95         sf_g->ttl = msecs_to_jiffies(VBSF_DEFAULT_TTL_MS);
    96 
    97     sf_g->uid = info->uid;
    98     sf_g->gid = info->gid;
     95        pSuperInfo->ttl = msecs_to_jiffies(VBSF_DEFAULT_TTL_MS);
     96
     97    pSuperInfo->uid = info->uid;
     98    pSuperInfo->gid = info->gid;
    9999
    100100    if ((unsigned)info->length >= RT_UOFFSETOF(struct vbsf_mount_info_new, tag)) {
    101101        /* new fields */
    102         sf_g->dmode = info->dmode;
    103         sf_g->fmode = info->fmode;
    104         sf_g->dmask = info->dmask;
    105         sf_g->fmask = info->fmask;
     102        pSuperInfo->dmode = info->dmode;
     103        pSuperInfo->fmode = info->fmode;
     104        pSuperInfo->dmask = info->dmask;
     105        pSuperInfo->fmask = info->fmask;
    106106    } else {
    107         sf_g->dmode = ~0;
    108         sf_g->fmode = ~0;
     107        pSuperInfo->dmode = ~0;
     108        pSuperInfo->fmode = ~0;
    109109    }
    110110
    111111    if ((unsigned)info->length >= RT_UOFFSETOF(struct vbsf_mount_info_new, cMaxIoPages)) {
    112         AssertCompile(sizeof(sf_g->tag) >= sizeof(info->tag));
    113         memcpy(sf_g->tag, info->tag, sizeof(info->tag));
    114         sf_g->tag[sizeof(sf_g->tag) - 1] = '\0';
     112        AssertCompile(sizeof(pSuperInfo->tag) >= sizeof(info->tag));
     113        memcpy(pSuperInfo->tag, info->tag, sizeof(info->tag));
     114        pSuperInfo->tag[sizeof(pSuperInfo->tag) - 1] = '\0';
    115115    } else {
    116         sf_g->tag[0] = '\0';
     116        pSuperInfo->tag[0] = '\0';
    117117    }
    118118
     
    124124       too hard as we'd have to retry with smaller requests when this
    125125       happens, which isn't too efficient. */
    126     sf_g->cMaxIoPages = RT_MIN(_16K / sizeof(RTGCPHYS64) /* => 8MB buffer */,
    127                                VMMDEV_MAX_HGCM_DATA_SIZE >> PAGE_SHIFT);
     126    pSuperInfo->cMaxIoPages = RT_MIN(_16K / sizeof(RTGCPHYS64) /* => 8MB buffer */,
     127                                     VMMDEV_MAX_HGCM_DATA_SIZE >> PAGE_SHIFT);
    128128    if (   (unsigned)info->length >= sizeof(struct vbsf_mount_info_new)
    129129        && info->cMaxIoPages > 0) {
    130130        if (info->cMaxIoPages <= VMMDEV_MAX_HGCM_DATA_SIZE >> PAGE_SHIFT)
    131             sf_g->cMaxIoPages = RT_MAX(info->cMaxIoPages, 2); /* read_iter/write_iter requires a minimum of 2. */
     131            pSuperInfo->cMaxIoPages = RT_MAX(info->cMaxIoPages, 2); /* read_iter/write_iter requires a minimum of 2. */
    132132        else
    133133            printk(KERN_WARNING "vboxsf: max I/O page count (%#x) is out of range, using default (%#x) instead.\n",
    134                    info->cMaxIoPages, sf_g->cMaxIoPages);
    135     }
    136 
    137     sf_g->cbDirBuf = _64K; /** @todo make configurable. */
     134                   info->cMaxIoPages, pSuperInfo->cMaxIoPages);
     135    }
     136
     137    pSuperInfo->cbDirBuf = _64K; /** @todo make configurable. */
    138138}
    139139
     
    146146    SHFLSTRING *str_name;
    147147    size_t name_len, str_len;
    148     struct vbsf_super_info *sf_g;
     148    struct vbsf_super_info *pSuperInfo;
    149149
    150150    TRACE();
     
    174174     * Allocate memory.
    175175     */
    176     str_len  = offsetof(SHFLSTRING, String.utf8) + name_len + 1;
    177     str_name = kmalloc(str_len, GFP_KERNEL);
    178     sf_g     = kmalloc(sizeof(*sf_g), GFP_KERNEL);
    179     if (sf_g && str_name) {
    180         RT_ZERO(*sf_g);
     176    str_len    = offsetof(SHFLSTRING, String.utf8) + name_len + 1;
     177    str_name   = (PSHFLSTRING)kmalloc(str_len, GFP_KERNEL);
     178    pSuperInfo = (struct vbsf_super_info *)kmalloc(sizeof(*pSuperInfo), GFP_KERNEL);
     179    if (pSuperInfo && str_name) {
     180        RT_ZERO(*pSuperInfo);
    181181
    182182        str_name->u16Length = name_len;
     
    192192
    193193        /* Check if NLS charset is valid and not points to UTF8 table */
    194         sf_g->fNlsIsUtf8 = true;
     194        pSuperInfo->fNlsIsUtf8 = true;
    195195        if (info->nls_name[0]) {
    196196            if (_IS_UTF8(info->nls_name)) {
    197197                SFLOGFLOW(("vbsf_super_info_alloc_and_map_it: nls=utf8\n"));
    198                 sf_g->nls = NULL;
     198                pSuperInfo->nls = NULL;
    199199            } else {
    200                 sf_g->fNlsIsUtf8 = false;
    201                 sf_g->nls = load_nls(info->nls_name);
    202                 if (sf_g->nls) {
    203                     SFLOGFLOW(("vbsf_super_info_alloc_and_map_it: nls=%s -> %p\n", info->nls_name, sf_g->nls));
     200                pSuperInfo->fNlsIsUtf8 = false;
     201                pSuperInfo->nls = load_nls(info->nls_name);
     202                if (pSuperInfo->nls) {
     203                    SFLOGFLOW(("vbsf_super_info_alloc_and_map_it: nls=%s -> %p\n", info->nls_name, pSuperInfo->nls));
    204204                } else {
    205205                    SFLOGRELBOTH(("vboxsf: Failed to load nls '%s'!\n", info->nls_name));
     
    213213            if (!_IS_UTF8(CONFIG_NLS_DEFAULT)
    214214                && !_IS_EMPTY(CONFIG_NLS_DEFAULT)) {
    215                 sf_g->fNlsIsUtf8 = false;
    216                 sf_g->nls = load_nls_default();
    217                 SFLOGFLOW(("vbsf_super_info_alloc_and_map_it: CONFIG_NLS_DEFAULT=%s -> %p\n", CONFIG_NLS_DEFAULT, sf_g->nls));
     215                pSuperInfo->fNlsIsUtf8 = false;
     216                pSuperInfo->nls = load_nls_default();
     217                SFLOGFLOW(("vbsf_super_info_alloc_and_map_it: CONFIG_NLS_DEFAULT=%s -> %p\n", CONFIG_NLS_DEFAULT, pSuperInfo->nls));
    218218            } else {
    219219                SFLOGFLOW(("vbsf_super_info_alloc_and_map_it: nls=utf8 (default %s)\n", CONFIG_NLS_DEFAULT));
    220                 sf_g->nls = NULL;
     220                pSuperInfo->nls = NULL;
    221221            }
    222222#else
    223223            SFLOGFLOW(("vbsf_super_info_alloc_and_map_it: nls=utf8 (no default)\n"));
    224             sf_g->nls = NULL;
     224            pSuperInfo->nls = NULL;
    225225#endif
    226226        }
     
    232232             */
    233233            rc = VbglR0SfHostReqMapFolderWithContigSimple(str_name, virt_to_phys(str_name), RTPATH_DELIMITER,
    234                                                           true /*fCaseSensitive*/, &sf_g->map.root);
     234                                                          true /*fCaseSensitive*/, &pSuperInfo->map.root);
    235235            if (RT_SUCCESS(rc)) {
    236236                kfree(str_name);
    237237
    238238                /* The rest is shared with remount. */
    239                 vbsf_super_info_copy_remount_options(sf_g, info);
    240 
    241                 *sf_gp = sf_g;
     239                vbsf_super_info_copy_remount_options(pSuperInfo, info);
     240
     241                *sf_gp = pSuperInfo;
    242242                return 0;
    243243            }
     
    253253                rc = -EPROTO;
    254254            }
    255             if (sf_g->nls)
    256                 unload_nls(sf_g->nls);
     255            if (pSuperInfo->nls)
     256                unload_nls(pSuperInfo->nls);
    257257        }
    258258    } else {
     
    262262    if (str_name)
    263263        kfree(str_name);
    264     if (sf_g)
    265         kfree(sf_g);
     264    if (pSuperInfo)
     265        kfree(pSuperInfo);
    266266    return rc;
    267267}
    268268
    269 /* unmap the share and free super info [sf_g] */
    270 static void vbsf_super_info_free(struct vbsf_super_info *sf_g)
     269/* unmap the share and free super info [pSuperInfo] */
     270static void vbsf_super_info_free(struct vbsf_super_info *pSuperInfo)
    271271{
    272272    int rc;
    273273
    274274    TRACE();
    275     rc = VbglR0SfHostReqUnmapFolderSimple(sf_g->map.root);
     275    rc = VbglR0SfHostReqUnmapFolderSimple(pSuperInfo->map.root);
    276276    if (RT_FAILURE(rc))
    277277        LogFunc(("VbglR0SfHostReqUnmapFolderSimple failed rc=%Rrc\n", rc));
    278278
    279     if (sf_g->nls)
    280         unload_nls(sf_g->nls);
    281 
    282     kfree(sf_g);
     279    if (pSuperInfo->nls)
     280        unload_nls(pSuperInfo->nls);
     281
     282    kfree(pSuperInfo);
    283283}
    284284
     
    287287 * Initialize backing device related matters.
    288288 */
    289 static int vbsf_init_backing_dev(struct super_block *sb, struct vbsf_super_info *sf_g)
     289static int vbsf_init_backing_dev(struct super_block *sb, struct vbsf_super_info *pSuperInfo)
    290290{
    291291    int rc = 0;
     
    307307        return rc;
    308308#  else
    309     bdi = &sf_g->bdi;
     309    bdi = &pSuperInfo->bdi;
    310310#  endif
    311311
     
    346346
    347347# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
    348     rc = bdi_init(&sf_g->bdi);
     348    rc = bdi_init(&pSuperInfo->bdi);
    349349#  if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
    350350    if (!rc)
    351         rc = bdi_register(&sf_g->bdi, NULL, "vboxsf-%llu", (unsigned long long)u64CurrentSequence);
     351        rc = bdi_register(&pSuperInfo->bdi, NULL, "vboxsf-%llu", (unsigned long long)u64CurrentSequence);
    352352#  endif /* >= 2.6.26 */
    353353# endif  /* 4.11.0 > version >= 2.6.24 */
     
    360360 * Undoes what vbsf_init_backing_dev did.
    361361 */
    362 static void vbsf_done_backing_dev(struct super_block *sb, struct vbsf_super_info *sf_g)
     362static void vbsf_done_backing_dev(struct super_block *sb, struct vbsf_super_info *pSuperInfo)
    363363{
    364364#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) && LINUX_VERSION_CODE <= KERNEL_VERSION(3, 19, 0)
    365     bdi_destroy(&sf_g->bdi);    /* includes bdi_unregister() */
     365    bdi_destroy(&pSuperInfo->bdi);    /* includes bdi_unregister() */
    366366#endif
    367367}
     
    372372 *
    373373 * @returns 0 on success, negative errno on failure.
    374  * @param   sb      The super block.
    375  * @param   sf_g    Our super block info.
    376  */
    377 static int vbsf_create_root_inode(struct super_block *sb, struct vbsf_super_info *sf_g)
     374 * @param   sb          The super block.
     375 * @param   pSuperInfo  Our super block info.
     376 */
     377static int vbsf_create_root_inode(struct super_block *sb, struct vbsf_super_info *pSuperInfo)
    378378{
    379379    SHFLFSOBJINFO fsinfo;
     
    402402         * Stat the root directory (for inode info).
    403403         */
    404         rc = vbsf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0);
     404        rc = vbsf_stat(__func__, pSuperInfo, sf_i->path, &fsinfo, 0);
    405405        if (rc == 0) {
    406406            /*
     
    414414#endif
    415415            if (iroot) {
    416                 vbsf_init_inode(iroot, sf_i, &fsinfo, sf_g);
     416                vbsf_init_inode(iroot, sf_i, &fsinfo, pSuperInfo);
    417417                VBSF_SET_INODE_INFO(iroot, sf_i);
    418418
     
    475475{
    476476    int rc;
    477     struct vbsf_super_info *sf_g;
     477    struct vbsf_super_info *pSuperInfo;
    478478
    479479    TRACE();
     
    491491     * Create our super info structure and map the shared folder.
    492492     */
    493     rc = vbsf_super_info_alloc_and_map_it((struct vbsf_mount_info_new *)data, &sf_g);
     493    rc = vbsf_super_info_alloc_and_map_it((struct vbsf_mount_info_new *)data, &pSuperInfo);
    494494    if (rc == 0) {
    495495        /*
     
    518518         * files among other things.
    519519         */
    520         rc = vbsf_init_backing_dev(sb, sf_g);
     520        rc = vbsf_init_backing_dev(sb, pSuperInfo);
    521521        if (rc == 0) {
    522522            /*
    523523             * Create the root inode and we're done.
    524524             */
    525             rc = vbsf_create_root_inode(sb, sf_g);
     525            rc = vbsf_create_root_inode(sb, pSuperInfo);
    526526            if (rc == 0) {
    527                 VBSF_SET_SUPER_INFO(sb, sf_g);
     527                VBSF_SET_SUPER_INFO(sb, pSuperInfo);
    528528                SFLOGFLOW(("vbsf_read_super_aux: returns successfully\n"));
    529529                return 0;
    530530            }
    531             vbsf_done_backing_dev(sb, sf_g);
     531            vbsf_done_backing_dev(sb, pSuperInfo);
    532532        } else
    533533            SFLOGRELBOTH(("vboxsf: backing device information initialization failed: %d\n", rc));
    534         vbsf_super_info_free(sf_g);
     534        vbsf_super_info_free(pSuperInfo);
    535535    }
    536536    return rc;
     
    595595
    596596/* vfs is done with [sb] (umount called) call [vbsf_super_info_free] to unmap
    597    the folder and free [sf_g] */
     597   the folder and free [pSuperInfo] */
    598598static void vbsf_put_super(struct super_block *sb)
    599599{
    600     struct vbsf_super_info *sf_g;
    601 
    602     sf_g = VBSF_GET_SUPER_INFO(sb);
    603     BUG_ON(!sf_g);
    604     vbsf_done_backing_dev(sb, sf_g);
    605     vbsf_super_info_free(sf_g);
     600    struct vbsf_super_info *pSuperInfo;
     601
     602    pSuperInfo = VBSF_GET_SUPER_INFO(sb);
     603    BUG_ON(!pSuperInfo);
     604    vbsf_done_backing_dev(sb, pSuperInfo);
     605    vbsf_super_info_free(pSuperInfo);
    606606}
    607607
     
    624624    VBOXSFVOLINFOREQ *pReq = (VBOXSFVOLINFOREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq));
    625625    if (pReq) {
    626         SHFLVOLINFO            *pVolInfo = &pReq->VolInfo;
    627         struct vbsf_super_info *sf_g    = VBSF_GET_SUPER_INFO(sb);
    628         rc = VbglR0SfHostReqQueryVolInfo(sf_g->map.root, pReq, SHFL_HANDLE_ROOT);
     626        SHFLVOLINFO            *pVolInfo   = &pReq->VolInfo;
     627        struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(sb);
     628        rc = VbglR0SfHostReqQueryVolInfo(pSuperInfo->map.root, pReq, SHFL_HANDLE_ROOT);
    629629        if (RT_SUCCESS(rc)) {
    630630            stat->f_type   = UINT32_C(0x786f4256); /* 'VBox' little endian */
     
    661661{
    662662#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 23)
    663     struct vbsf_super_info *sf_g;
     663    struct vbsf_super_info *pSuperInfo = pSuperInfo = VBSF_GET_SUPER_INFO(sb);
    664664    struct vbsf_inode_info *sf_i;
    665665    struct inode *iroot;
    666666    SHFLFSOBJINFO fsinfo;
    667667    int err;
    668 
    669     sf_g = VBSF_GET_SUPER_INFO(sb);
    670     BUG_ON(!sf_g);
     668    Assert(pSuperInfo);
     669
    671670    if (data && data[0] != 0) {
    672671        struct vbsf_mount_info_new *info = (struct vbsf_mount_info_new *)data;
     
    675674            && info->signature[1] == VBSF_MOUNT_SIGNATURE_BYTE_1
    676675            && info->signature[2] == VBSF_MOUNT_SIGNATURE_BYTE_2) {
    677             vbsf_super_info_copy_remount_options(sf_g, info);
     676            vbsf_super_info_copy_remount_options(pSuperInfo, info);
    678677        }
    679678    }
     
    684683
    685684    sf_i = VBSF_GET_INODE_INFO(iroot);
    686     err = vbsf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0);
     685    err = vbsf_stat(__func__, pSuperInfo, sf_i->path, &fsinfo, 0);
    687686    BUG_ON(err != 0);
    688     vbsf_init_inode(iroot, sf_i, &fsinfo, sf_g);
     687    vbsf_init_inode(iroot, sf_i, &fsinfo, pSuperInfo);
    689688    /*unlock_new_inode(iroot); */
    690689    return 0;
     
    708707{
    709708#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
    710     struct super_block *sb = mnt->mnt_sb;
     709    struct super_block     *sb        = mnt->mnt_sb;
    711710#else
    712     struct super_block *sb = root->d_sb;
    713 #endif
    714     struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(sb);
    715     if (sf_g) {
     711    struct super_block     *sb        = root->d_sb;
     712#endif
     713    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(sb);
     714    if (pSuperInfo) {
    716715        seq_printf(m, ",uid=%u,gid=%u,ttl=%d,maxiopages=%u,iocharset=%s",
    717                    sf_g->uid, sf_g->gid, sf_g->ttl_msec, sf_g->cMaxIoPages, sf_g->nls ? sf_g->nls->charset : "utf8");
    718         if (sf_g->dmode != ~0)
    719             seq_printf(m, ",dmode=0%o", sf_g->dmode);
    720         if (sf_g->fmode != ~0)
    721             seq_printf(m, ",fmode=0%o", sf_g->fmode);
    722         if (sf_g->dmask != 0)
    723             seq_printf(m, ",dmask=0%o", sf_g->dmask);
    724         if (sf_g->fmask != 0)
    725             seq_printf(m, ",fmask=0%o", sf_g->fmask);
    726         if (sf_g->tag[0] != '\0') {
     716                   pSuperInfo->uid, pSuperInfo->gid, pSuperInfo->ttl_msec, pSuperInfo->cMaxIoPages,
     717                   pSuperInfo->nls ? pSuperInfo->nls->charset : "utf8");
     718        if (pSuperInfo->dmode != ~0)
     719            seq_printf(m, ",dmode=0%o", pSuperInfo->dmode);
     720        if (pSuperInfo->fmode != ~0)
     721            seq_printf(m, ",fmode=0%o", pSuperInfo->fmode);
     722        if (pSuperInfo->dmask != 0)
     723            seq_printf(m, ",dmask=0%o", pSuperInfo->dmask);
     724        if (pSuperInfo->fmask != 0)
     725            seq_printf(m, ",fmask=0%o", pSuperInfo->fmask);
     726        if (pSuperInfo->tag[0] != '\0') {
    727727            seq_puts(m, ",tag=");
    728             seq_escape(m, sf_g->tag, " \t\n\\");
     728            seq_escape(m, pSuperInfo->tag, " \t\n\\");
    729729        }
    730730    }
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h

    r77873 r77951  
    157157   pointers of arbitrary type */
    158158#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
    159 # define VBSF_GET_SUPER_INFO(sb)       ((struct vbsf_super_info *)(sb)->u.generic_sbp)
    160 # define VBSF_SET_SUPER_INFO(sb, sf_g) do { (sb)->u.generic_sbp = sf_g; } while (0)
     159# define VBSF_GET_SUPER_INFO(sb)                ((struct vbsf_super_info *)(sb)->u.generic_sbp)
     160# define VBSF_SET_SUPER_INFO(sb, a_pSuperInfo)  do { (sb)->u.generic_sbp = a_pSuperInfo; } while (0)
    161161#else
    162 # define VBSF_GET_SUPER_INFO(sb)       ((struct vbsf_super_info *)(sb)->s_fs_info)
    163 # define VBSF_SET_SUPER_INFO(sb, sf_g) do { (sb)->s_fs_info = sf_g;} while (0)
     162# define VBSF_GET_SUPER_INFO(sb)                ((struct vbsf_super_info *)(sb)->s_fs_info)
     163# define VBSF_SET_SUPER_INFO(sb, a_pSuperInfo)  do { (sb)->s_fs_info = a_pSuperInfo;} while (0)
    164164#endif
    165165
     
    238238#endif
    239239
    240 extern void vbsf_init_inode(struct inode *inode, struct vbsf_inode_info *sf_i, PSHFLFSOBJINFO info, struct vbsf_super_info *sf_g);
     240extern void vbsf_init_inode(struct inode *inode, struct vbsf_inode_info *sf_i, PSHFLFSOBJINFO info,
     241                            struct vbsf_super_info *pSuperInfo);
    241242extern void vbsf_update_inode(struct inode *pInode, struct vbsf_inode_info *pInodeInfo, PSHFLFSOBJINFO pObjInfo,
    242                               struct vbsf_super_info *sf_g, bool fInodeLocked);
     243                              struct vbsf_super_info *pSuperInfo, bool fInodeLocked);
    243244extern int  vbsf_inode_revalidate_worker(struct dentry *dentry, bool fForced, bool fInodeLocked);
    244245extern int  vbsf_inode_revalidate_with_handle(struct dentry *dentry, SHFLHANDLE hHostFile, bool fForced, bool fInodeLocked);
     
    257258extern void              vbsf_handle_drop_chain(struct vbsf_inode_info *pInodeInfo);
    258259extern struct vbsf_handle *vbsf_handle_find(struct vbsf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear);
    259 extern uint32_t          vbsf_handle_release_slow(struct vbsf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller);
     260extern uint32_t          vbsf_handle_release_slow(struct vbsf_handle *pHandle, struct vbsf_super_info *pSuperInfo,
     261                                                  const char *pszCaller);
    260262extern void              vbsf_handle_append(struct vbsf_inode_info *pInodeInfo, struct vbsf_handle *pHandle);
    261263
     
    265267 * @returns New reference count.
    266268 * @param   pHandle         The handle to release.
    267  * @param   sf_g            The info structure for the shared folder associated
     269 * @param   pSuperInfo      The info structure for the shared folder associated
    268270 *                          with the handle.
    269271 * @param   pszCaller       The caller name (for logging failures).
    270272 */
    271 DECLINLINE(uint32_t) vbsf_handle_release(struct vbsf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller)
     273DECLINLINE(uint32_t) vbsf_handle_release(struct vbsf_handle *pHandle, struct vbsf_super_info *pSuperInfo, const char *pszCaller)
    272274{
    273275    uint32_t cRefs;
     
    281283    if (cRefs)
    282284        return cRefs;
    283     return vbsf_handle_release_slow(pHandle, sf_g, pszCaller);
     285    return vbsf_handle_release_slow(pHandle, pSuperInfo, pszCaller);
    284286}
    285287
     
    405407#endif
    406408
    407 extern int  vbsf_stat(const char *caller, struct vbsf_super_info *sf_g, SHFLSTRING * path, PSHFLFSOBJINFO result, int ok_to_fail);
    408 extern int  vbsf_path_from_dentry(struct vbsf_super_info *sf_g, struct vbsf_inode_info *sf_i, struct dentry *dentry,
     409extern int  vbsf_stat(const char *caller, struct vbsf_super_info *pSuperInfo, SHFLSTRING * path, PSHFLFSOBJINFO result,
     410                      int ok_to_fail);
     411extern int  vbsf_path_from_dentry(struct vbsf_super_info *pSuperInfo, struct vbsf_inode_info *sf_i, struct dentry *dentry,
    409412                                  SHFLSTRING ** result, const char *caller);
    410 extern int  vbsf_nlscpy(struct vbsf_super_info *sf_g, char *name, size_t name_bound_len,
     413extern int  vbsf_nlscpy(struct vbsf_super_info *pSuperInfo, char *name, size_t name_bound_len,
    411414                        const unsigned char *utf8_name, size_t utf8_len);
    412 extern int  vbsf_nls_to_shflstring(struct vbsf_super_info *sf_g, const char *pszNls, PSHFLSTRING *ppString);
     415extern int  vbsf_nls_to_shflstring(struct vbsf_super_info *pSuperInfo, const char *pszNls, PSHFLSTRING *ppString);
    413416
    414417
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