- Timestamp:
- Mar 29, 2019 1:26:53 PM (6 years ago)
- Location:
- trunk/src/VBox/Additions/linux/sharedfolders
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/dirops.c
r77873 r77951 51 51 static int vbsf_dir_open(struct inode *inode, struct file *file) 52 52 { 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); 56 56 struct vbsf_dir_info *sf_d; 57 57 int rc; 58 58 59 59 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); 61 61 AssertReturn(sf_i, -EINVAL); 62 62 AssertReturn(!file->private_data, 0); … … 88 88 LogFunc(("calling VbglR0SfHostReqCreate on folder %s, flags %#x\n", 89 89 sf_i->path->String.utf8, pReq->CreateParms.CreateFlags)); 90 rc = VbglR0SfHostReqCreate( sf_g->map.root, pReq);90 rc = VbglR0SfHostReqCreate(pSuperInfo->map.root, pReq); 91 91 if (RT_SUCCESS(rc)) { 92 92 if (pReq->CreateParms.Result == SHFL_FILE_EXISTS) { … … 97 97 * dentry cache chain that got us here. 98 98 */ 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 */); 100 100 vbsf_dentry_chain_increase_ttl(dentry); 101 101 … … 154 154 155 155 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); 157 157 158 158 /* Invalidate the non-handle part. */ … … 168 168 169 169 /* 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"); 171 171 } 172 172 … … 201 201 * @returns 0 on success, negative errno on error, 202 202 */ 203 static int vbsf_dir_read_more(struct vbsf_dir_info *sf_d, struct vbsf_super_info * sf_g, bool fRestart)203 static int vbsf_dir_read_more(struct vbsf_dir_info *sf_d, struct vbsf_super_info *pSuperInfo, bool fRestart) 204 204 { 205 205 int rc; … … 224 224 /* Likely, except for the first time. */ 225 225 } else { 226 sf_d->pBuf = (PSHFLDIRINFO)kmalloc( sf_g->cbDirBuf, GFP_KERNEL);226 sf_d->pBuf = (PSHFLDIRINFO)kmalloc(pSuperInfo->cbDirBuf, GFP_KERNEL); 227 227 if (sf_d->pBuf) 228 sf_d->cbBuf = sf_g->cbDirBuf;228 sf_d->cbBuf = pSuperInfo->cbDirBuf; 229 229 else { 230 230 sf_d->pBuf = (PSHFLDIRINFO)kmalloc(_4K, GFP_KERNEL); … … 242 242 pReq = (VBOXSFLISTDIRREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq)); 243 243 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, 245 245 fRestart ? SHFL_LIST_RESTART : SHFL_LIST_NONE, 246 246 sf_d->pBuf, virt_to_phys(sf_d->pBuf), sf_d->cbBuf); … … 285 285 # endif 286 286 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) 288 288 { 289 289 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); 291 291 if (rc == 0) { 292 292 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) … … 337 337 loff_t offPos = dir->f_pos; 338 338 #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); 341 341 int rc; 342 342 … … 358 358 loff_t offCurEntry = sf_d->offPos; 359 359 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*/); 361 361 if (rc == 0) 362 362 offCurEntry = 0; … … 375 375 sf_d->offPos = offCurEntry; 376 376 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*/); 378 378 if (rc != 0 || sf_d->cEntriesLeft == 0) { 379 379 up(&sf_d->Lock); … … 459 459 uint32_t cEntriesLeft = sf_d->cEntriesLeft; 460 460 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*/); 462 462 if (rc == 0) { 463 463 cEntriesLeft = sf_d->cEntriesLeft; … … 504 504 ino_t const d_ino = (ino_t)offPos + 0xbeef; /* very fake */ 505 505 bool fContinue; 506 if ( sf_g->fNlsIsUtf8) {506 if (pSuperInfo->fNlsIsUtf8) { 507 507 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) 508 508 fContinue = dir_emit(ctx, pEntry->name.String.ach, cchSrcName, d_ino, d_type); … … 512 512 } else { 513 513 #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); 515 515 #else 516 516 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); 518 518 #endif 519 519 } … … 579 579 */ 580 580 static 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) 582 582 { 583 583 /* … … 606 606 607 607 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); 609 609 610 610 /* … … 657 657 ) 658 658 { 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); 660 660 struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(parent); 661 661 SHFLSTRING *path; … … 671 671 #endif 672 672 673 Assert( sf_g);673 Assert(pSuperInfo); 674 674 Assert(sf_i && sf_i->u32Magic == SF_INODE_INFO_MAGIC); 675 675 … … 677 677 * Build the path. We'll associate the path with dret's inode on success. 678 678 */ 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__); 680 680 if (rc == 0) { 681 681 /* … … 692 692 693 693 LogFunc(("Calling VbglR0SfHostReqCreate on %s\n", path->String.utf8)); 694 rc = VbglR0SfHostReqCreate( sf_g->map.root, pReq);694 rc = VbglR0SfHostReqCreate(pSuperInfo->map.root, pReq); 695 695 if (RT_SUCCESS(rc)) { 696 696 if (pReq->CreateParms.Result == SHFL_FILE_EXISTS) { … … 699 699 * the existence of all parent dentries, we increase their TTL. 700 700 */ 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*/); 702 702 if (rc == 0) { 703 703 path = NULL; /* given to the inode */ … … 755 755 PSHFLFSOBJINFO info, SHFLHANDLE handle) 756 756 { 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*/); 759 759 if (pInode) { 760 760 /* Store this handle if we leave the handle open. */ … … 791 791 #endif 792 792 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); 794 794 PSHFLSTRING path; 795 795 int rc; 796 796 797 797 AssertReturn(sf_parent_i, -EINVAL); 798 AssertReturn( sf_g, -EINVAL);798 AssertReturn(pSuperInfo, -EINVAL); 799 799 800 800 /* 801 801 * Build a path. We'll donate this to the inode on success. 802 802 */ 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__); 804 804 if (rc == 0) { 805 805 /* … … 822 822 823 823 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); 825 825 if (RT_SUCCESS(rc)) { 826 826 SFLOGFLOW(("%s VbglR0SfHostReqCreate returned %Rrc Result=%d Handle=%#llx\n", … … 842 842 */ 843 843 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, 845 845 !fDoLookup /*fInstantiate*/); 846 846 if (pNewInode) { … … 868 868 if (fDoLookup) { 869 869 struct inode *pNewInode = vbsf_create_inode(parent, dentry, path, &pReq->Create.CreateParms.Info, 870 sf_g, false /*fInstantiate*/);870 pSuperInfo, false /*fInstantiate*/); 871 871 if (pNewInode) 872 872 vbsf_d_add_inode(dentry, pNewInode); … … 893 893 if (pReq->Create.CreateParms.Handle != SHFL_HANDLE_NIL) { 894 894 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); 896 896 if (RT_FAILURE(rc2)) 897 897 SFLOGFLOW(("%s VbglR0SfHostReqCloseSimple failed rc=%Rrc\n", pszPrefix, rc2)); … … 989 989 sf_r = NULL; /* don't free it */ 990 990 } 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); 992 992 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); 994 994 sf_r->Handle.hHost = SHFL_HANDLE_NIL; 995 995 } … … 1096 1096 static int vbsf_unlink_worker(struct inode *parent, struct dentry *dentry, int fDirectory) 1097 1097 { 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); 1099 1099 struct vbsf_inode_info *sf_parent_i = VBSF_GET_INODE_INFO(parent); 1100 1100 SHFLSTRING *path; … … 1103 1103 TRACE(); 1104 1104 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__); 1106 1106 if (!rc) { 1107 1107 VBOXSFREMOVEREQ *pReq = (VBOXSFREMOVEREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFREMOVEREQ, StrPath.String) … … 1113 1113 fFlags |= SHFL_REMOVE_SYMLINK; 1114 1114 1115 rc = VbglR0SfHostReqRemove( sf_g->map.root, pReq, fFlags);1115 rc = VbglR0SfHostReqRemove(pSuperInfo->map.root, pReq, fFlags); 1116 1116 1117 1117 if (dentry->d_inode) { … … 1198 1198 * Check that they are on the same mount. 1199 1199 */ 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)) { 1202 1202 /* 1203 1203 * Build the new path. … … 1205 1205 struct vbsf_inode_info *sf_new_parent_i = VBSF_GET_INODE_INFO(new_parent); 1206 1206 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__); 1208 1208 if (rc == 0) { 1209 1209 /* … … 1218 1218 1219 1219 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); 1221 1221 VbglR0PhysHeapFree(pReq); 1222 1222 if (RT_SUCCESS(rc)) { … … 1257 1257 } else { 1258 1258 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)); 1260 1260 rc = -EXDEV; 1261 1261 } … … 1294 1294 /** @todo we can save a kmalloc here if we switch to embedding the target rather 1295 1295 * 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); 1299 1299 if (rc == 0) { 1300 1300 /* … … 1303 1303 struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(parent); 1304 1304 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__); 1306 1306 if (rc == 0) { 1307 1307 /* … … 1314 1314 memcpy(&pReq->StrSymlinkPath, pPath, SHFLSTRING_HEADER_SIZE + pPath->u16Size); 1315 1315 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); 1317 1317 if (RT_SUCCESS(rc)) { 1318 1318 sf_i->force_restat = 1; -
trunk/src/VBox/Additions/linux/sharedfolders/lnkops.c
r77950 r77951 119 119 pszTarget = (char *)kzalloc(PAGE_SIZE, GFP_KERNEL); 120 120 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, 124 124 pszTarget, virt_to_phys(pszTarget), RT_MIN(PATH_MAX, PAGE_SIZE - 1)); 125 125 if (RT_SUCCESS(rc)) { 126 126 pszTarget[PAGE_SIZE - 1] = '\0'; 127 127 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); 129 129 if (rc == 0) { 130 130 vbsf_dentry_chain_increase_ttl(dentry); … … 157 157 if (pszTarget) { 158 158 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, 162 162 pszTarget, virt_to_phys(pszTarget), RT_MIN(PATH_MAX, PAGE_SIZE - 1)); 163 163 if (RT_SUCCESS(rc)) { 164 164 pszTarget[PAGE_SIZE - 1] = '\0'; 165 165 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); 167 167 if (rc == 0) { 168 168 vbsf_dentry_chain_increase_ttl(dentry); … … 195 195 if (pszTarget) { 196 196 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, 201 201 pszTarget, virt_to_phys(pszTarget), RT_MIN(PATH_MAX, PAGE_SIZE - 1)); 202 202 if (RT_SUCCESS(rc)) { 203 203 pszTarget[PAGE_SIZE - 1] = '\0'; 204 204 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); 206 206 if (rc == 0) { 207 207 /* -
trunk/src/VBox/Additions/linux/sharedfolders/regops.c
r77949 r77951 447 447 * 448 448 * @returns 0 (ref count). 449 * @param pHandle 450 * @param sf_g The info structure for the shared folder associated451 * withthe handle.452 * @param pszCaller 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 */ 454 uint32_t vbsf_handle_release_slow(struct vbsf_handle *pHandle, struct vbsf_super_info *pSuperInfo, const char *pszCaller) 455 455 { 456 456 int rc; … … 478 478 * Actually destroy it. 479 479 */ 480 rc = VbglR0SfHostReqCloseSimple( sf_g->map.root, pHandle->hHost);480 rc = VbglR0SfHostReqCloseSimple(pSuperInfo->map.root, pHandle->hHost); 481 481 if (RT_FAILURE(rc)) 482 482 LogFunc(("Caller %s: VbglR0SfHostReqCloseSimple %#RX64 failed with rc=%Rrc\n", pszCaller, pHandle->hHost, rc)); … … 537 537 * already. 538 538 */ 539 DECLINLINE(bool) vbsf_should_use_cached_read(struct file *file, struct address_space *mapping, struct vbsf_super_info * sf_g)539 DECLINLINE(bool) vbsf_should_use_cached_read(struct file *file, struct address_space *mapping, struct vbsf_super_info *pSuperInfo) 540 540 { 541 541 return mapping … … 543 543 && mapping_writably_mapped(mapping) 544 544 && !(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) */; 546 546 } 547 547 … … 757 757 static ssize_t vbsf_splice_read(struct file *file, loff_t *poffset, struct pipe_inode_info *pipe, size_t len, unsigned int flags) 758 758 { 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); 761 761 ssize_t cbRet; 762 762 763 763 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)) { 765 765 cbRet = generic_file_splice_read(file, poffset, pipe, len, flags); 766 766 } else { … … 801 801 uint32_t const cbToRead = RT_MIN((cPages << PAGE_SHIFT) - (offFile & PAGE_OFFSET_MASK), len); 802 802 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); 804 804 if (RT_SUCCESS(vrc)) { 805 805 /* … … 853 853 static ssize_t vbsf_splice_write(struct pipe_inode_info *pPipe, struct file *file, loff_t *poffset, size_t len, unsigned int flags) 854 854 { 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); 857 857 ssize_t cbRet; 858 858 … … 923 923 we'll only end up having to cancel the HGCM request 99% of the time: */ 924 924 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); 926 927 else 927 928 vrc = VERR_INTERRUPTED; … … 1050 1051 ) 1051 1052 { 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); 1054 1055 ssize_t cbRet; 1055 1056 SFLOGFLOW(("vbsf_reg_sendfile: pFile=%p poffFile=%p{%#RX64} cbToSend=%#zx pfnActor=%p pvUser=%p\n", 1056 1057 pFile, poffFile, poffFile ? *poffFile : 0, cbToSend, pfnActor, pvUser)); 1057 Assert( sf_g);1058 Assert(pSuperInfo); 1058 1059 1059 1060 /* … … 1067 1068 * the page cache in some cases or configs. 1068 1069 */ 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)) { 1070 1071 cbRet = generic_file_sendfile(pFile, poffFile, cbToSend, pfnActor, pvUser); 1071 1072 SFLOGFLOW(("vbsf_reg_sendfile: returns %#zx *poffFile=%#RX64 [generic_file_sendfile]\n", cbRet, poffFile ? *poffFile : UINT64_MAX)); … … 1127 1128 pReq->PgLst.offFirstPage = (uint16_t)offPg0; 1128 1129 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); 1130 1132 else 1131 1133 vrc = VERR_INTERRUPTED; … … 1453 1455 */ 1454 1456 static 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) 1456 1458 { 1457 1459 /* … … 1468 1470 ssize_t cbRet = -ENOMEM; 1469 1471 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); 1471 1473 bool fLockPgHack; 1472 1474 … … 1508 1510 * Issue the request and unlock the pages. 1509 1511 */ 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); 1511 1513 1512 1514 vbsf_unlock_user_pages(papPages, cPages, true /*fSetDirty*/, fLockPgHack); … … 1569 1571 static ssize_t vbsf_reg_read(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off) 1570 1572 { 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; 1575 1577 1576 1578 SFLOGFLOW(("vbsf_reg_read: inode=%p file=%p buf=%p size=%#zx off=%#llx\n", inode, file, buf, size, *off)); … … 1592 1594 * mappings around with any kind of pages loaded. 1593 1595 */ 1594 if (vbsf_should_use_cached_read(file, mapping, sf_g))1596 if (vbsf_should_use_cached_read(file, mapping, pSuperInfo)) 1595 1597 return vbsf_reg_read_mapped(file, buf, size, off); 1596 1598 … … 1605 1607 if ((PAGE_SIZE - ((uintptr_t)pReq & PAGE_OFFSET_MASK)) >= cbReq) { 1606 1608 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); 1608 1610 if (RT_SUCCESS(vrc)) { 1609 1611 cbRet = pReq->Parms.cb32Read.u.value32; … … 1632 1634 if (pReq) { 1633 1635 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, 1635 1637 (uint32_t)size, pvBounce, virt_to_phys(pvBounce)); 1636 1638 if (RT_SUCCESS(vrc)) { … … 1652 1654 #endif 1653 1655 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); 1655 1657 } 1656 1658 … … 1749 1751 static ssize_t vbsf_reg_write_locking(struct file *file, const char /*__user*/ *buf, size_t size, loff_t *off, loff_t offFile, 1750 1752 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) 1752 1754 { 1753 1755 /* … … 1763 1765 ssize_t cbRet = -ENOMEM; 1764 1766 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); 1766 1768 bool fLockPgHack; 1767 1769 … … 1803 1805 * Issue the request and unlock the pages. 1804 1806 */ 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); 1806 1808 if (RT_SUCCESS(rc)) { 1807 1809 /* … … 1872 1874 static ssize_t vbsf_reg_write(struct file *file, const char *buf, size_t size, loff_t * off) 1873 1875 { 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; 1879 1881 loff_t pos; 1880 1882 1881 1883 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); 1885 1887 AssertReturn(S_ISREG(inode->i_mode), -EINVAL); 1886 1888 … … 1926 1928 ssize_t cbRet; 1927 1929 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, 1929 1931 pos, (uint32_t)size); 1930 1932 if (RT_SUCCESS(vrc)) { … … 1961 1963 if (pReq) { 1962 1964 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, 1964 1966 (uint32_t)size, pvBounce, virt_to_phys(pvBounce)); 1965 1967 if (RT_SUCCESS(vrc)) { … … 1988 1990 #endif 1989 1991 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); 1991 1993 } 1992 1994 … … 2359 2361 */ 2360 2362 static 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) 2362 2364 { 2363 2365 /* … … 2371 2373 ssize_t cbRet = 0; 2372 2374 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); 2374 2376 2375 2377 pReq = (VBOXSFREADPGLSTREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF_DYN(VBOXSFREADPGLSTREQ, PgLst.aPages[cMaxPages])); … … 2410 2412 * Issue the request and unlock the pages. 2411 2413 */ 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); 2413 2415 SFLOGFLOW(("vbsf_reg_read_iter_locking: VbglR0SfHostReqReadPgLst -> %d (cbActual=%#x cbChunk=%#zx of %#zx cPages=%#zx offPage0=%#x\n", 2414 2416 rc, pReq->Parms.cb32Read.u.value32, cbChunk, cbToRead, cPages, offPage0)); … … 2487 2489 { 2488 2490 # 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); 2498 2500 2499 2501 SFLOGFLOW(("vbsf_reg_read_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n", … … 2513 2515 * mappings around with any kind of pages loaded. 2514 2516 */ 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)) { 2516 2518 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) 2517 2519 return generic_file_read_iter(kio, iter); … … 2539 2541 if ((PAGE_SIZE - ((uintptr_t)pReq & PAGE_OFFSET_MASK)) >= cbReq) { 2540 2542 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); 2542 2545 if (RT_SUCCESS(vrc)) { 2543 2546 cbRet = pReq->Parms.cb32Read.u.value32; … … 2562 2565 * Otherwise do the page locking thing. 2563 2566 */ 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); 2565 2568 } 2566 2569 … … 2571 2574 */ 2572 2575 static 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, 2574 2577 struct inode *inode, struct vbsf_inode_info *sf_i, struct address_space *mapping) 2575 2578 { … … 2584 2587 ssize_t cbRet = 0; 2585 2588 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); 2587 2590 2588 2591 pReq = (VBOXSFWRITEPGLSTREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF_DYN(VBOXSFWRITEPGLSTREQ, PgLst.aPages[cMaxPages])); … … 2623 2626 * Issue the request and unlock the pages. 2624 2627 */ 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); 2626 2629 SFLOGFLOW(("vbsf_reg_write_iter_locking: VbglR0SfHostReqWritePgLst -> %d (cbActual=%#x cbChunk=%#zx of %#zx cPages=%#zx offPage0=%#x\n", 2627 2630 rc, pReq->Parms.cb32Write.u.value32, cbChunk, cbToWrite, cPages, offPage0)); … … 2707 2710 { 2708 2711 # 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); 2719 2722 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) 2720 loff_t offFile = kio->ki_pos;2723 loff_t offFile = kio->ki_pos; 2721 2724 # endif 2722 2725 … … 2778 2781 ssize_t cbRet; 2779 2782 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, 2781 2784 offFile, (uint32_t)cbToWrite); 2782 2785 if (RT_SUCCESS(vrc)) { … … 2808 2811 * Otherwise do the page locking thing. 2809 2812 */ 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); 2811 2814 } 2812 2815 … … 2898 2901 { 2899 2902 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); 2903 2906 struct vbsf_reg_info *sf_r; 2904 2907 VBOXSFCREATEREQ *pReq; 2905 2908 2906 2909 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); 2909 2912 2910 2913 sf_r = kmalloc(sizeof(*sf_r), GFP_KERNEL); … … 2960 2963 LogFunc(("vbsf_reg_open: calling VbglR0SfHostReqCreate, file %s, flags=%#x, %#x\n", 2961 2964 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); 2963 2966 if (RT_FAILURE(rc)) { 2964 2967 LogFunc(("VbglR0SfHostReqCreate failed flags=%d,%#x rc=%Rrc\n", file->f_flags, pReq->CreateParms.CreateFlags, rc)); … … 3015 3018 SFLOGFLOW(("vbsf_reg_release: inode=%p file=%p\n", inode, file)); 3016 3019 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); 3019 3022 3020 3023 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25) … … 3031 3034 /* Release sf_r, closing the handle if we're the last user. */ 3032 3035 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"); 3034 3037 3035 3038 sf_i->handle = SHFL_HANDLE_NIL; … … 3456 3459 VBOXSFREADPGLSTREQ *pReq = (VBOXSFREADPGLSTREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq)); 3457 3460 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; 3460 3463 uint32_t cbRead; 3461 3464 int vrc; … … 3463 3466 pReq->PgLst.offFirstPage = 0; 3464 3467 pReq->PgLst.aPages[0] = page_to_phys(page); 3465 vrc = VbglR0SfHostReqReadPgLst( sf_g->map.root,3468 vrc = VbglR0SfHostReqReadPgLst(pSuperInfo->map.root, 3466 3469 pReq, 3467 3470 sf_r->Handle.hHost, … … 3518 3521 3519 3522 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)); 3522 3525 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_SIZE3526 : (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; 3527 3530 int vrc; 3528 3531 3529 3532 pReq->PgLst.offFirstPage = 0; 3530 3533 pReq->PgLst.aPages[0] = page_to_phys(page); 3531 vrc = VbglR0SfHostReqWritePgLst( sf_g->map.root,3534 vrc = VbglR0SfHostReqWritePgLst(pSuperInfo->map.root, 3532 3535 pReq, 3533 3536 pHandle->hHost, … … 3558 3561 } else 3559 3562 err = -ENOMEM; 3560 vbsf_handle_release(pHandle, sf_g, "vbsf_writepage");3563 vbsf_handle_release(pHandle, pSuperInfo, "vbsf_writepage"); 3561 3564 } else { 3562 3565 static uint64_t volatile s_cCalls = 0; -
trunk/src/VBox/Additions/linux/sharedfolders/utils.c
r77858 r77951 37 37 38 38 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) 39 int vbsf_nlscpy(struct vbsf_super_info *pSuperInfo, char *name, size_t name_bound_len, 40 const unsigned char *utf8_name, size_t utf8_len) 40 41 { 41 42 Assert(name_bound_len > 1); 42 43 Assert(RTStrNLen(utf8_name, utf8_len) == utf8_len); 43 44 44 if ( sf_g->nls) {45 if (pSuperInfo->nls) { 45 46 const char *in = utf8_name; 46 47 size_t in_bound_len = utf8_len; … … 58 59 #endif 59 60 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); 61 62 if (cbOutEnc >= 0) { 62 63 /*SFLOG3(("vbsf_nlscpy: cbOutEnc=%d cbInEnc=%d uni=%#x in_bound_len=%u\n", cbOutEnc, cbInEnc, uni, in_bound_len));*/ … … 94 95 * the output buffer (use kfree on result). 95 96 */ 96 int vbsf_nls_to_shflstring(struct vbsf_super_info * sf_g, const char *pszNls, PSHFLSTRING *ppString)97 int vbsf_nls_to_shflstring(struct vbsf_super_info *pSuperInfo, const char *pszNls, PSHFLSTRING *ppString) 97 98 { 98 99 int rc; 99 100 size_t const cchNls = strlen(pszNls); 100 101 PSHFLSTRING pString = NULL; 101 if ( sf_g->nls) {102 if (pSuperInfo->nls) { 102 103 /* 103 104 * NLS -> UTF-8 w/ SHLF string header. … … 108 109 while (offNls < cchNls) { 109 110 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); 111 112 if (cbNlsCodepoint >= 0) { 112 113 char achTmp[16]; … … 142 143 while (offNls < cchNls) { 143 144 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); 145 146 if (cbNlsCodepoint >= 0) { 146 147 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) … … 293 294 294 295 /** 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 */ 299 void vbsf_init_inode(struct inode *inode, struct vbsf_inode_info *sf_i, PSHFLFSOBJINFO pObjInfo, 300 struct vbsf_super_info *pSuperInfo) 298 301 { 299 302 PCSHFLFSOBJATTR pAttr = &pObjInfo->Attr; … … 307 310 inode->i_mapping->a_ops = &vbsf_reg_aops; 308 311 # 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. */ 310 313 # endif 311 314 #endif 312 315 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); 314 317 inode->i_op = &vbsf_dir_iops; 315 318 inode->i_fop = &vbsf_dir_fops; … … 322 325 /** @todo r=bird: Aren't System V symlinks w/o any mode mask? IIRC there is 323 326 * 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); 325 328 inode->i_op = &vbsf_lnk_iops; 326 329 set_nlink(inode, 1); 327 330 } 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); 329 332 inode->i_op = &vbsf_reg_iops; 330 333 inode->i_fop = &vbsf_reg_fops; … … 333 336 334 337 #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); 337 340 #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; 340 343 #endif 341 344 … … 363 366 */ 364 367 void 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) 366 369 { 367 370 PCSHFLFSOBJATTR pAttr = &pObjInfo->Attr; … … 379 382 */ 380 383 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); 382 385 else if (RTFS_IS_SYMLINK(pAttr->fMode)) 383 386 /** @todo r=bird: Aren't System V symlinks w/o any mode mask? IIRC there is 384 387 * 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); 386 389 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); 388 391 389 392 if (fMode == pInode->i_mode) { … … 396 399 pInode->i_mode & S_IFMT, fMode & S_IFMT, pInodeInfo->path->String.ach)); 397 400 /** @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); 399 402 400 403 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) … … 435 438 436 439 /** @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)440 int vbsf_stat(const char *caller, struct vbsf_super_info *pSuperInfo, SHFLSTRING *path, PSHFLFSOBJINFO result, int ok_to_fail) 438 441 { 439 442 int rc; … … 451 454 452 455 LogFunc(("Calling VbglR0SfHostReqCreate on %s\n", path->String.utf8)); 453 rc = VbglR0SfHostReqCreate( sf_g->map.root, pReq);456 rc = VbglR0SfHostReqCreate(pSuperInfo->map.root, pReq); 454 457 if (RT_SUCCESS(rc)) { 455 458 if (pReq->CreateParms.Result == SHFL_FILE_EXISTS) { … … 486 489 struct inode *pInode = dentry ? dentry->d_inode : NULL; 487 490 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); 490 493 AssertReturn(sf_i, -EINVAL); 491 AssertReturn( sf_g, -EINVAL);494 AssertReturn(pSuperInfo, -EINVAL); 492 495 493 496 /* … … 496 499 if ( !fForced 497 500 && !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) 499 502 rc = 0; 500 503 else { … … 509 512 if (pReq) { 510 513 RT_ZERO(*pReq); 511 rc = VbglR0SfHostReqQueryObjInfo( sf_g->map.root, pReq, pHandle->hHost);514 rc = VbglR0SfHostReqQueryObjInfo(pSuperInfo->map.root, pReq, pHandle->hHost); 512 515 if (RT_SUCCESS(rc)) { 513 516 /* 514 517 * Reset the TTL and copy the info over into the inode structure. 515 518 */ 516 vbsf_update_inode(pInode, sf_i, &pReq->ObjInfo, sf_g, fInodeLocked);519 vbsf_update_inode(pInode, sf_i, &pReq->ObjInfo, pSuperInfo, fInodeLocked); 517 520 } else if (rc == VERR_INVALID_HANDLE) { 518 521 rc = -ENOENT; /* Restore.*/ … … 524 527 } else 525 528 rc = -ENOMEM; 526 vbsf_handle_release(pHandle, sf_g, "vbsf_inode_revalidate_worker");529 vbsf_handle_release(pHandle, pSuperInfo, "vbsf_inode_revalidate_worker"); 527 530 528 531 } else { … … 536 539 pReq->CreateParms.CreateFlags = SHFL_CF_LOOKUP | SHFL_CF_ACT_FAIL_IF_NEW; 537 540 538 rc = VbglR0SfHostReqCreate( sf_g->map.root, pReq);541 rc = VbglR0SfHostReqCreate(pSuperInfo->map.root, pReq); 539 542 if (RT_SUCCESS(rc)) { 540 543 if (pReq->CreateParms.Result == SHFL_FILE_EXISTS) { … … 542 545 * Reset the TTL and copy the info over into the inode structure. 543 546 */ 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); 545 548 rc = 0; 546 549 } else { … … 598 601 err = -EINVAL; 599 602 } 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); 602 605 AssertReturn(sf_i, -EINVAL); 603 AssertReturn( sf_g, -EINVAL);606 AssertReturn(pSuperInfo, -EINVAL); 604 607 605 608 /* … … 608 611 if ( !fForced 609 612 && !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) 611 614 err = 0; 612 615 else { … … 617 620 if (pReq) { 618 621 RT_ZERO(*pReq); 619 err = VbglR0SfHostReqQueryObjInfo( sf_g->map.root, pReq, hHostFile);622 err = VbglR0SfHostReqQueryObjInfo(pSuperInfo->map.root, pReq, hHostFile); 620 623 if (RT_SUCCESS(err)) { 621 624 /* 622 625 * Reset the TTL and copy the info over into the inode structure. 623 626 */ 624 vbsf_update_inode(pInode, sf_i, &pReq->ObjInfo, sf_g, fInodeLocked);627 vbsf_update_inode(pInode, sf_i, &pReq->ObjInfo, pSuperInfo, fInodeLocked); 625 628 } else { 626 629 LogFunc(("VbglR0SfHostReqQueryObjInfo failed on %#RX64: %Rrc\n", hHostFile, err)); … … 730 733 int vbsf_inode_setattr(struct dentry *dentry, struct iattr *iattr) 731 734 { 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); 735 738 int vrc; 736 739 int rc; … … 791 794 pReq->Create.CreateParms.CreateFlags |= SHFL_CF_ACCESS_WRITE; 792 795 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); 794 797 if (RT_SUCCESS(vrc)) { 795 798 if (pReq->Create.CreateParms.Result == SHFL_FILE_EXISTS) { … … 835 838 836 839 /* Make the change. */ 837 vrc = VbglR0SfHostReqSetObjInfo( sf_g->map.root, &pReq->Info, hHostFile);840 vrc = VbglR0SfHostReqSetObjInfo(pSuperInfo->map.root, &pReq->Info, hHostFile); 838 841 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*/); 840 843 } else { 841 844 rc = -RTErrConvertToErrno(vrc); … … 850 853 */ 851 854 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); 853 856 if (RT_SUCCESS(vrc)) { 854 857 i_size_write(pInode, iattr->ia_size); … … 857 860 RT_ZERO(pReq->Info.ObjInfo); 858 861 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); 860 863 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*/); 862 865 } 863 866 if (RT_SUCCESS(vrc)) { … … 875 878 */ 876 879 if (!pHandle) { 877 vrc = VbglR0SfHostReqClose( sf_g->map.root, &pReq->Close, hHostFile);880 vrc = VbglR0SfHostReqClose(pSuperInfo->map.root, &pReq->Close, hHostFile); 878 881 if (RT_FAILURE(vrc)) 879 882 LogFunc(("VbglR0SfHostReqClose(%s [%#llx]) failed vrc=%Rrc\n", sf_i->path->String.utf8, hHostFile, vrc)); … … 883 886 VbglR0PhysHeapFree(pReq); 884 887 if (pHandle) 885 vbsf_handle_release(pHandle, sf_g, "vbsf_inode_setattr");888 vbsf_handle_release(pHandle, pSuperInfo, "vbsf_inode_setattr"); 886 889 } else 887 890 SFLOGFLOW(("vbsf_inode_setattr: Notthing to do here (%#x).\n", iattr->ia_valid)); … … 942 945 /** 943 946 * [dentry] contains string encoded in coding system that corresponds 944 * to [ sf_g]->nls, we must convert it to UTF8 here and pass down to947 * to [pSuperInfo]->nls, we must convert it to UTF8 here and pass down to 945 948 * [vbsf_make_path] which will allocate SHFLSTRING and fill it in 946 949 */ 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)950 int vbsf_path_from_dentry(struct vbsf_super_info *pSuperInfo, struct vbsf_inode_info *sf_i, struct dentry *dentry, 951 SHFLSTRING **result, const char *caller) 949 952 { 950 953 int err; … … 958 961 d_len = dentry->d_name.len; 959 962 960 if ( sf_g->nls) {963 if (pSuperInfo->nls) { 961 964 size_t in_len, i, out_bound_len; 962 965 const char *in; … … 976 979 int nb; 977 980 978 nb = sf_g->nls->char2uni(in, in_len, &uni);981 nb = pSuperInfo->nls->char2uni(in, in_len, &uni); 979 982 if (nb < 0) { 980 983 LogFunc(("nls->char2uni failed %x %d\n", … … 1080 1083 //struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(pInode); 1081 1084 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)); 1085 1088 rc = 1; 1086 1089 } else if (!vbsf_inode_revalidate_worker(dentry, true /*fForced*/, false /*fInodeLocked*/)) { 1087 1090 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)); 1089 1092 rc = 1; 1090 1093 } 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)); 1092 1095 rc = 0; 1093 1096 } … … 1114 1117 /* Can we skip revalidation based on TTL? */ 1115 1118 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)); 1119 1122 rc = 1; 1120 1123 } else { … … 1122 1125 have the caller kick it out. */ 1123 1126 /** @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)); 1125 1128 rc = 0; 1126 1129 } -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c
r77863 r77951 80 80 81 81 /** 82 * Copies options from the mount info structure into @a sf_g.82 * Copies options from the mount info structure into @a pSuperInfo. 83 83 * 84 84 * This is used both by vbsf_super_info_alloc_and_map_it() and 85 85 * vbsf_remount_fs(). 86 86 */ 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;87 static 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; 90 90 if (info->ttl > 0) 91 sf_g->ttl = msecs_to_jiffies(info->ttl);91 pSuperInfo->ttl = msecs_to_jiffies(info->ttl); 92 92 else if (info->ttl == 0 || info->ttl != -1) 93 sf_g->ttl = sf_g->ttl_msec = 0;93 pSuperInfo->ttl = pSuperInfo->ttl_msec = 0; 94 94 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; 99 99 100 100 if ((unsigned)info->length >= RT_UOFFSETOF(struct vbsf_mount_info_new, tag)) { 101 101 /* 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; 106 106 } else { 107 sf_g->dmode = ~0;108 sf_g->fmode = ~0;107 pSuperInfo->dmode = ~0; 108 pSuperInfo->fmode = ~0; 109 109 } 110 110 111 111 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'; 115 115 } else { 116 sf_g->tag[0] = '\0';116 pSuperInfo->tag[0] = '\0'; 117 117 } 118 118 … … 124 124 too hard as we'd have to retry with smaller requests when this 125 125 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); 128 128 if ( (unsigned)info->length >= sizeof(struct vbsf_mount_info_new) 129 129 && info->cMaxIoPages > 0) { 130 130 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. */ 132 132 else 133 133 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. */ 138 138 } 139 139 … … 146 146 SHFLSTRING *str_name; 147 147 size_t name_len, str_len; 148 struct vbsf_super_info * sf_g;148 struct vbsf_super_info *pSuperInfo; 149 149 150 150 TRACE(); … … 174 174 * Allocate memory. 175 175 */ 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); 181 181 182 182 str_name->u16Length = name_len; … … 192 192 193 193 /* Check if NLS charset is valid and not points to UTF8 table */ 194 sf_g->fNlsIsUtf8 = true;194 pSuperInfo->fNlsIsUtf8 = true; 195 195 if (info->nls_name[0]) { 196 196 if (_IS_UTF8(info->nls_name)) { 197 197 SFLOGFLOW(("vbsf_super_info_alloc_and_map_it: nls=utf8\n")); 198 sf_g->nls = NULL;198 pSuperInfo->nls = NULL; 199 199 } 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)); 204 204 } else { 205 205 SFLOGRELBOTH(("vboxsf: Failed to load nls '%s'!\n", info->nls_name)); … … 213 213 if (!_IS_UTF8(CONFIG_NLS_DEFAULT) 214 214 && !_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)); 218 218 } else { 219 219 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; 221 221 } 222 222 #else 223 223 SFLOGFLOW(("vbsf_super_info_alloc_and_map_it: nls=utf8 (no default)\n")); 224 sf_g->nls = NULL;224 pSuperInfo->nls = NULL; 225 225 #endif 226 226 } … … 232 232 */ 233 233 rc = VbglR0SfHostReqMapFolderWithContigSimple(str_name, virt_to_phys(str_name), RTPATH_DELIMITER, 234 true /*fCaseSensitive*/, & sf_g->map.root);234 true /*fCaseSensitive*/, &pSuperInfo->map.root); 235 235 if (RT_SUCCESS(rc)) { 236 236 kfree(str_name); 237 237 238 238 /* 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; 242 242 return 0; 243 243 } … … 253 253 rc = -EPROTO; 254 254 } 255 if ( sf_g->nls)256 unload_nls( sf_g->nls);255 if (pSuperInfo->nls) 256 unload_nls(pSuperInfo->nls); 257 257 } 258 258 } else { … … 262 262 if (str_name) 263 263 kfree(str_name); 264 if ( sf_g)265 kfree( sf_g);264 if (pSuperInfo) 265 kfree(pSuperInfo); 266 266 return rc; 267 267 } 268 268 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] */ 270 static void vbsf_super_info_free(struct vbsf_super_info *pSuperInfo) 271 271 { 272 272 int rc; 273 273 274 274 TRACE(); 275 rc = VbglR0SfHostReqUnmapFolderSimple( sf_g->map.root);275 rc = VbglR0SfHostReqUnmapFolderSimple(pSuperInfo->map.root); 276 276 if (RT_FAILURE(rc)) 277 277 LogFunc(("VbglR0SfHostReqUnmapFolderSimple failed rc=%Rrc\n", rc)); 278 278 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); 283 283 } 284 284 … … 287 287 * Initialize backing device related matters. 288 288 */ 289 static int vbsf_init_backing_dev(struct super_block *sb, struct vbsf_super_info * sf_g)289 static int vbsf_init_backing_dev(struct super_block *sb, struct vbsf_super_info *pSuperInfo) 290 290 { 291 291 int rc = 0; … … 307 307 return rc; 308 308 # else 309 bdi = & sf_g->bdi;309 bdi = &pSuperInfo->bdi; 310 310 # endif 311 311 … … 346 346 347 347 # 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); 349 349 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) 350 350 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); 352 352 # endif /* >= 2.6.26 */ 353 353 # endif /* 4.11.0 > version >= 2.6.24 */ … … 360 360 * Undoes what vbsf_init_backing_dev did. 361 361 */ 362 static void vbsf_done_backing_dev(struct super_block *sb, struct vbsf_super_info * sf_g)362 static void vbsf_done_backing_dev(struct super_block *sb, struct vbsf_super_info *pSuperInfo) 363 363 { 364 364 #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() */ 366 366 #endif 367 367 } … … 372 372 * 373 373 * @returns 0 on success, negative errno on failure. 374 * @param sb The super block.375 * @param sf_gOur 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 */ 377 static int vbsf_create_root_inode(struct super_block *sb, struct vbsf_super_info *pSuperInfo) 378 378 { 379 379 SHFLFSOBJINFO fsinfo; … … 402 402 * Stat the root directory (for inode info). 403 403 */ 404 rc = vbsf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0);404 rc = vbsf_stat(__func__, pSuperInfo, sf_i->path, &fsinfo, 0); 405 405 if (rc == 0) { 406 406 /* … … 414 414 #endif 415 415 if (iroot) { 416 vbsf_init_inode(iroot, sf_i, &fsinfo, sf_g);416 vbsf_init_inode(iroot, sf_i, &fsinfo, pSuperInfo); 417 417 VBSF_SET_INODE_INFO(iroot, sf_i); 418 418 … … 475 475 { 476 476 int rc; 477 struct vbsf_super_info * sf_g;477 struct vbsf_super_info *pSuperInfo; 478 478 479 479 TRACE(); … … 491 491 * Create our super info structure and map the shared folder. 492 492 */ 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); 494 494 if (rc == 0) { 495 495 /* … … 518 518 * files among other things. 519 519 */ 520 rc = vbsf_init_backing_dev(sb, sf_g);520 rc = vbsf_init_backing_dev(sb, pSuperInfo); 521 521 if (rc == 0) { 522 522 /* 523 523 * Create the root inode and we're done. 524 524 */ 525 rc = vbsf_create_root_inode(sb, sf_g);525 rc = vbsf_create_root_inode(sb, pSuperInfo); 526 526 if (rc == 0) { 527 VBSF_SET_SUPER_INFO(sb, sf_g);527 VBSF_SET_SUPER_INFO(sb, pSuperInfo); 528 528 SFLOGFLOW(("vbsf_read_super_aux: returns successfully\n")); 529 529 return 0; 530 530 } 531 vbsf_done_backing_dev(sb, sf_g);531 vbsf_done_backing_dev(sb, pSuperInfo); 532 532 } else 533 533 SFLOGRELBOTH(("vboxsf: backing device information initialization failed: %d\n", rc)); 534 vbsf_super_info_free( sf_g);534 vbsf_super_info_free(pSuperInfo); 535 535 } 536 536 return rc; … … 595 595 596 596 /* 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] */ 598 598 static void vbsf_put_super(struct super_block *sb) 599 599 { 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); 606 606 } 607 607 … … 624 624 VBOXSFVOLINFOREQ *pReq = (VBOXSFVOLINFOREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq)); 625 625 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); 629 629 if (RT_SUCCESS(rc)) { 630 630 stat->f_type = UINT32_C(0x786f4256); /* 'VBox' little endian */ … … 661 661 { 662 662 #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); 664 664 struct vbsf_inode_info *sf_i; 665 665 struct inode *iroot; 666 666 SHFLFSOBJINFO fsinfo; 667 667 int err; 668 669 sf_g = VBSF_GET_SUPER_INFO(sb); 670 BUG_ON(!sf_g); 668 Assert(pSuperInfo); 669 671 670 if (data && data[0] != 0) { 672 671 struct vbsf_mount_info_new *info = (struct vbsf_mount_info_new *)data; … … 675 674 && info->signature[1] == VBSF_MOUNT_SIGNATURE_BYTE_1 676 675 && 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); 678 677 } 679 678 } … … 684 683 685 684 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); 687 686 BUG_ON(err != 0); 688 vbsf_init_inode(iroot, sf_i, &fsinfo, sf_g);687 vbsf_init_inode(iroot, sf_i, &fsinfo, pSuperInfo); 689 688 /*unlock_new_inode(iroot); */ 690 689 return 0; … … 708 707 { 709 708 #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; 711 710 #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) { 716 715 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') { 727 727 seq_puts(m, ",tag="); 728 seq_escape(m, sf_g->tag, " \t\n\\");728 seq_escape(m, pSuperInfo->tag, " \t\n\\"); 729 729 } 730 730 } -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h
r77873 r77951 157 157 pointers of arbitrary type */ 158 158 #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) 161 161 #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) 164 164 #endif 165 165 … … 238 238 #endif 239 239 240 extern void vbsf_init_inode(struct inode *inode, struct vbsf_inode_info *sf_i, PSHFLFSOBJINFO info, struct vbsf_super_info *sf_g); 240 extern void vbsf_init_inode(struct inode *inode, struct vbsf_inode_info *sf_i, PSHFLFSOBJINFO info, 241 struct vbsf_super_info *pSuperInfo); 241 242 extern 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); 243 244 extern int vbsf_inode_revalidate_worker(struct dentry *dentry, bool fForced, bool fInodeLocked); 244 245 extern int vbsf_inode_revalidate_with_handle(struct dentry *dentry, SHFLHANDLE hHostFile, bool fForced, bool fInodeLocked); … … 257 258 extern void vbsf_handle_drop_chain(struct vbsf_inode_info *pInodeInfo); 258 259 extern 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); 260 extern uint32_t vbsf_handle_release_slow(struct vbsf_handle *pHandle, struct vbsf_super_info *pSuperInfo, 261 const char *pszCaller); 260 262 extern void vbsf_handle_append(struct vbsf_inode_info *pInodeInfo, struct vbsf_handle *pHandle); 261 263 … … 265 267 * @returns New reference count. 266 268 * @param pHandle The handle to release. 267 * @param sf_gThe info structure for the shared folder associated269 * @param pSuperInfo The info structure for the shared folder associated 268 270 * with the handle. 269 271 * @param pszCaller The caller name (for logging failures). 270 272 */ 271 DECLINLINE(uint32_t) vbsf_handle_release(struct vbsf_handle *pHandle, struct vbsf_super_info * sf_g, const char *pszCaller)273 DECLINLINE(uint32_t) vbsf_handle_release(struct vbsf_handle *pHandle, struct vbsf_super_info *pSuperInfo, const char *pszCaller) 272 274 { 273 275 uint32_t cRefs; … … 281 283 if (cRefs) 282 284 return cRefs; 283 return vbsf_handle_release_slow(pHandle, sf_g, pszCaller);285 return vbsf_handle_release_slow(pHandle, pSuperInfo, pszCaller); 284 286 } 285 287 … … 405 407 #endif 406 408 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, 409 extern int vbsf_stat(const char *caller, struct vbsf_super_info *pSuperInfo, SHFLSTRING * path, PSHFLFSOBJINFO result, 410 int ok_to_fail); 411 extern int vbsf_path_from_dentry(struct vbsf_super_info *pSuperInfo, struct vbsf_inode_info *sf_i, struct dentry *dentry, 409 412 SHFLSTRING ** result, const char *caller); 410 extern int vbsf_nlscpy(struct vbsf_super_info * sf_g, char *name, size_t name_bound_len,413 extern int vbsf_nlscpy(struct vbsf_super_info *pSuperInfo, char *name, size_t name_bound_len, 411 414 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);415 extern int vbsf_nls_to_shflstring(struct vbsf_super_info *pSuperInfo, const char *pszNls, PSHFLSTRING *ppString); 413 416 414 417
Note:
See TracChangeset
for help on using the changeset viewer.