Changeset 77303 in vbox
- Timestamp:
- Feb 13, 2019 2:49:11 PM (6 years ago)
- Location:
- trunk/src/VBox/Additions/linux/sharedfolders
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/Makefile.module
r77057 r77303 65 65 MOD_DEFS += -DRT_ARCH_X86 66 66 endif 67 ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE68 MOD_DEFS += -DVBOXSF_USE_DEPRECATED_VBGL_INTERFACE69 endif70 67 71 68 ifeq ($(KERN_VERSION), 24) -
trunk/src/VBox/Additions/linux/sharedfolders/dirops.c
r77054 r77303 32 32 #include <iprt/err.h> 33 33 34 /** Reads or re-reads a directory. 34 35 /** 36 * Reads or re-reads a directory. 35 37 * 36 38 * @note As suggested a couple of other places, we should probably stop … … 42 44 int rc; 43 45 int err; 44 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE45 SHFLCREATEPARMS CreateParms;46 SHFLCREATEPARMS *pCreateParms = &CreateParms;47 #else48 46 union SfDirOpenCloseReq 49 47 { … … 52 50 } *pReq; 53 51 SHFLCREATEPARMS *pCreateParms; 54 #endif 55 56 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE 52 57 53 pReq = (union SfDirOpenCloseReq *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath.String) 58 54 + sf_i->path->u16Size); … … 66 62 return -ENOMEM; 67 63 } 68 #endif69 64 70 65 RT_ZERO(*pCreateParms); … … 75 70 | SHFL_CF_ACCESS_READ; 76 71 77 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE78 LogFunc(("calling VbglR0SfCreate, folder %s, flags %#x [caller: %s]\n",79 sf_i->path->String.utf8, pCreateParms->CreateFlags, pszCaller));80 rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path, pCreateParms);81 #else82 72 LogFunc(("calling VbglR0SfHostReqCreate on folder %s, flags %#x [caller: %s]\n", 83 73 sf_i->path->String.utf8, pCreateParms->CreateFlags, pszCaller)); 84 74 rc = VbglR0SfHostReqCreate(sf_g->map.root, &pReq->Create); 85 #endif86 75 if (RT_SUCCESS(rc)) { 87 76 if (pCreateParms->Result == SHFL_FILE_EXISTS) { … … 100 89 err = -ENOENT; 101 90 102 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE103 rc = VbglR0SfClose(&client_handle, &sf_g->map, pCreateParms->Handle);104 if (RT_FAILURE(rc))105 LogFunc(("VbglR0SfClose(%s) after err=%d failed rc=%Rrc caller=%s\n",106 sf_i->path->String.utf8, err, rc, pszCaller));107 #else108 91 AssertCompile(RTASSERT_OFFSET_OF(VBOXSFCREATEREQ, CreateParms.Handle) > sizeof(VBOXSFCLOSEREQ)); /* no aliasing issues */ 109 92 if (pCreateParms->Handle != SHFL_HANDLE_NIL) … … 114 97 sf_i->path->String.utf8, err, rc, pszCaller)); 115 98 } 116 #endif117 99 } else 118 100 err = -EPERM; 119 101 120 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE121 102 VbglR0PhysHeapFree(pReq); 122 #endif123 124 103 return err; 125 104 } … … 579 558 struct sf_glob_info *sf_g = GET_GLOB_INFO(parent->i_sb); 580 559 SHFLSTRING *path; 581 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE582 SHFLCREATEPARMS CreateParms;583 SHFLCREATEPARMS *pCreateParms = &CreateParms;584 #else585 560 union CreateAuxReq 586 561 { … … 589 564 } *pReq; 590 565 SHFLCREATEPARMS *pCreateParms; 591 #endif592 566 593 567 TRACE(); … … 599 573 goto fail0; 600 574 601 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE602 575 /** @todo combine with sf_path_from_dentry? */ 603 576 pReq = (union CreateAuxReq *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath.String) + path->u16Size); … … 609 582 goto fail1; 610 583 } 611 #endif612 584 613 585 RT_ZERO(*pCreateParms); … … 621 593 pCreateParms->Info.Attr.enmAdditional = RTFSOBJATTRADD_NOTHING; 622 594 623 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE624 LogFunc(("calling VbglR0SfCreate, folder %s, flags %#x\n", path->String.utf8, pCreateParms->CreateFlags));625 rc = VbglR0SfCreate(&client_handle, &sf_g->map, path, pCreateParms);626 #else627 595 LogFunc(("calling VbglR0SfHostReqCreate, folder %s, flags %#x\n", path->String.ach, pCreateParms->CreateFlags)); 628 596 rc = VbglR0SfHostReqCreate(sf_g->map.root, &pReq->Create); 629 #endif630 597 if (RT_FAILURE(rc)) { 631 598 if (rc == VERR_WRITE_PROTECT) { … … 660 627 */ 661 628 if (fDirectory) { 662 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE663 rc = VbglR0SfClose(&client_handle, &sf_g->map, pCreateParms->Handle);664 if (RT_FAILURE(rc))665 LogFunc(("(%d): VbglR0SfClose failed rc=%Rrc\n",666 fDirectory, rc));667 #else668 629 AssertCompile(RTASSERT_OFFSET_OF(VBOXSFCREATEREQ, CreateParms.Handle) > sizeof(VBOXSFCLOSEREQ)); /* no aliasing issues */ 669 630 rc = VbglR0SfHostReqClose(sf_g->map.root, &pReq->Close, pCreateParms->Handle); 670 631 if (RT_FAILURE(rc)) 671 632 LogFunc(("(%d): VbglR0SfHostReqClose failed rc=%Rrc\n", fDirectory, rc)); 672 #endif673 633 } 674 634 675 635 sf_i->force_restat = 1; 676 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE677 636 VbglR0PhysHeapFree(pReq); 678 #endif679 637 return 0; 680 638 681 639 fail3: 682 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE683 rc = VbglR0SfClose(&client_handle, &sf_g->map, pCreateParms->Handle);684 if (RT_FAILURE(rc))685 LogFunc(("(%d): VbglR0SfClose failed rc=%Rrc\n", fDirectory,686 rc));687 #else688 640 rc = VbglR0SfHostReqClose(sf_g->map.root, &pReq->Close, pCreateParms->Handle); 689 641 if (RT_FAILURE(rc)) 690 642 LogFunc(("(%d): VbglR0SfHostReqCloseSimple failed rc=%Rrc\n", fDirectory, rc)); 691 #endif692 643 fail2: 693 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE694 644 VbglR0PhysHeapFree(pReq); 695 #endif696 645 fail1: 697 646 kfree(path); … … 766 715 err = sf_path_from_dentry(__func__, sf_g, sf_i, dentry, &path); 767 716 if (!err) { 768 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE769 717 VBOXSFREMOVEREQ *pReq = (VBOXSFREMOVEREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFREMOVEREQ, StrPath.String) 770 718 + path->u16Size); 771 719 if (pReq) { 772 720 memcpy(&pReq->StrPath, path, SHFLSTRING_HEADER_SIZE + path->u16Size); 773 #endif774 721 uint32_t fFlags = fDirectory ? SHFL_REMOVE_DIR : SHFL_REMOVE_FILE; 775 722 if (dentry->d_inode && ((dentry->d_inode->i_mode & S_IFLNK) == S_IFLNK)) 776 723 fFlags |= SHFL_REMOVE_SYMLINK; 777 724 778 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE779 rc = VbglR0SfRemove(&client_handle, &sf_g->map, path, fFlags);780 #else781 725 rc = VbglR0SfHostReqRemove(sf_g->map.root, pReq, fFlags); 782 #endif783 726 if (RT_SUCCESS(rc)) { 784 727 /* directory access/change time changed */ … … 793 736 err = -RTErrConvertToErrno(rc); 794 737 } 795 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE796 738 VbglR0PhysHeapFree(pReq); 797 739 } else 798 740 err = -ENOMEM; 799 #endif800 741 kfree(path); 801 742 } … … 881 822 LogFunc(("failed to create new path\n")); 882 823 else { 883 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE884 int fDir =885 ((old_dentry->d_inode->i_mode & S_IFDIR) != 0);886 rc = VbglR0SfRename(&client_handle, &sf_g->map,887 old_path, new_path,888 fDir ? 0 : SHFL_RENAME_FILE |889 SHFL_RENAME_REPLACE_IF_EXISTS);890 #else891 824 VBOXSFRENAMEWITHSRCBUFREQ *pReq; 892 825 pReq = (VBOXSFRENAMEWITHSRCBUFREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFRENAMEWITHSRCBUFREQ, … … 902 835 } else 903 836 rc = VERR_NO_MEMORY; 904 #endif905 837 if (RT_SUCCESS(rc)) { 906 838 kfree(old_path); -
trunk/src/VBox/Additions/linux/sharedfolders/regops.c
r77141 r77303 35 35 #include "vfsmod.h" 36 36 37 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE 38 39 static void *alloc_bounce_buffer(size_t * tmp_sizep, PRTCCPHYS physp, size_t 40 xfer_size, const char *caller) 41 { 42 size_t tmp_size; 43 void *tmp; 44 45 /* try for big first. */ 46 tmp_size = RT_ALIGN_Z(xfer_size, PAGE_SIZE); 47 if (tmp_size > 16U * _1K) 48 tmp_size = 16U * _1K; 49 tmp = kmalloc(tmp_size, GFP_KERNEL); 50 if (!tmp) { 51 /* fall back on a page sized buffer. */ 52 tmp = kmalloc(PAGE_SIZE, GFP_KERNEL); 53 if (!tmp) { 54 LogRel(("%s: could not allocate bounce buffer for xfer_size=%zu %s\n", caller, xfer_size)); 55 return NULL; 56 } 57 tmp_size = PAGE_SIZE; 58 } 59 60 *tmp_sizep = tmp_size; 61 *physp = virt_to_phys(tmp); 62 return tmp; 63 } 64 65 static void free_bounce_buffer(void *tmp) 66 { 67 kfree(tmp); 68 } 69 70 #else /* !VBOXSF_USE_DEPRECATED_VBGL_INTERFACE */ 71 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) 37 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) 72 38 73 39 /* 74 40 * inode compatibility glue. 75 41 */ 76 # 42 #include <iprt/asm.h> 77 43 78 44 DECLINLINE(loff_t) i_size_read(struct inode *inode) … … 88 54 } 89 55 90 # endif /* < 2.6.0 */ 91 #endif /* !VBOXSF_USE_DEPRECATED_VBGL_INTERFACE */ 56 #endif /* < 2.6.0 */ 92 57 93 58 /* fops */ … … 201 166 size_t nsent = 0; 202 167 168 /** @todo rig up a FsPerf test for this code */ 203 169 TRACE(); 204 170 if (!S_ISREG(inode->i_mode)) { … … 329 295 330 296 331 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE332 297 /** 333 298 * Fallback case of sf_reg_read() that locks the user buffers and let the host … … 437 402 return cbRet; 438 403 } 439 #endif /* VBOXSF_USE_DEPRECATED_VBGL_INTERFACE */440 404 441 405 … … 452 416 loff_t *off) 453 417 { 454 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE455 int err;456 void *tmp;457 RTCCPHYS tmp_phys;458 size_t tmp_size;459 size_t left = size;460 ssize_t total_bytes_read = 0;461 loff_t pos = *off;462 #endif463 418 struct inode *inode = GET_F_DENTRY(file)->d_inode; 464 419 struct sf_glob_info *sf_g = GET_GLOB_INFO(inode->i_sb); … … 476 431 return 0; 477 432 478 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE479 tmp = alloc_bounce_buffer(&tmp_size, &tmp_phys, size, __PRETTY_FUNCTION__);480 if (!tmp)481 return -ENOMEM;482 483 while (left) {484 uint32_t to_read, nread;485 486 to_read = tmp_size;487 if (to_read > left)488 to_read = (uint32_t) left;489 490 nread = to_read;491 492 err = sf_reg_read_aux(__func__, sf_g, sf_r, tmp, &nread, pos);493 if (err)494 goto fail;495 496 if (copy_to_user(buf, tmp, nread)) {497 err = -EFAULT;498 goto fail;499 }500 501 pos += nread;502 left -= nread;503 buf += nread;504 total_bytes_read += nread;505 if (nread != to_read)506 break;507 }508 509 *off += total_bytes_read;510 free_bounce_buffer(tmp);511 return total_bytes_read;512 513 fail:514 free_bounce_buffer(tmp);515 return err;516 517 #else /* !VBOXSF_USE_DEPRECATED_VBGL_INTERFACE */518 433 /* 519 434 * For small requests, try use an embedded buffer provided we get a heap block … … 574 489 575 490 return sf_reg_read_fallback(file, buf, size, off, sf_g, sf_r); 576 #endif /* !VBOXSF_USE_DEPRECATED_VBGL_INTERFACE */ 577 } 578 579 580 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE 491 } 492 493 581 494 /** 582 495 * Fallback case of sf_reg_write() that locks the user buffers and let the host … … 689 602 return cbRet; 690 603 } 691 #endif /* VBOXSF_USE_DEPRECATED_VBGL_INTERFACE */ 604 692 605 693 606 /** … … 703 616 loff_t * off) 704 617 { 705 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE706 int err;707 void *tmp;708 RTCCPHYS tmp_phys;709 size_t tmp_size;710 size_t left = size;711 ssize_t total_bytes_written = 0;712 #endif713 618 loff_t pos; 714 619 struct inode *inode = GET_F_DENTRY(file)->d_inode; … … 730 635 /** @todo This should be handled by the host, it returning the new file 731 636 * offset when appending. We may have an outdated i_size value here! */ 732 if (file->f_flags & O_APPEND) { 733 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE 734 pos = inode->i_size; 735 *off = pos; 736 #else 637 if (file->f_flags & O_APPEND) 737 638 pos = i_size_read(inode); 738 #endif739 }740 639 741 640 /** @todo XXX Check write permission according to inode->i_mode! */ 742 641 743 642 if (!size) { 744 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE745 643 if (file->f_flags & O_APPEND) /** @todo check if this is the consensus behavior... */ 746 644 *off = pos; 747 #endif748 645 return 0; 749 646 } 750 751 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE752 tmp = alloc_bounce_buffer(&tmp_size, &tmp_phys, size,753 __PRETTY_FUNCTION__);754 if (!tmp)755 return -ENOMEM;756 757 while (left) {758 uint32_t to_write, nwritten;759 760 to_write = tmp_size;761 if (to_write > left)762 to_write = (uint32_t) left;763 764 nwritten = to_write;765 766 if (copy_from_user(tmp, buf, to_write)) {767 err = -EFAULT;768 goto fail;769 }770 771 err =772 VbglR0SfWritePhysCont(&client_handle, &sf_g->map,773 sf_r->handle, pos, &nwritten,774 tmp_phys);775 err = RT_FAILURE(err) ? -EPROTO : 0;776 if (err)777 goto fail;778 779 pos += nwritten;780 left -= nwritten;781 buf += nwritten;782 total_bytes_written += nwritten;783 if (nwritten != to_write)784 break;785 }786 787 *off += total_bytes_written;788 if (*off > inode->i_size)789 inode->i_size = *off;790 791 sf_i->force_restat = 1;792 free_bounce_buffer(tmp);793 return total_bytes_written;794 795 fail:796 free_bounce_buffer(tmp);797 return err;798 #else /* !VBOXSF_USE_DEPRECATED_VBGL_INTERFACE */799 647 800 648 /* … … 867 715 868 716 return sf_reg_write_fallback(file, buf, size, off, pos, inode, sf_i, sf_g, sf_r); 869 #endif /* !VBOXSF_USE_DEPRECATED_VBGL_INTERFACE */ 870 } 717 } 718 871 719 872 720 /** … … 883 731 struct sf_inode_info *sf_i = GET_INODE_INFO(inode); 884 732 struct sf_reg_info *sf_r; 885 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE886 SHFLCREATEPARMS params;887 #else888 733 VBOXSFCREATEREQ *pReq; 889 #endif890 734 SHFLCREATEPARMS *pCreateParms; /* temp glue */ 891 735 … … 917 761 } 918 762 919 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE920 RT_ZERO(params);921 pCreateParms = ¶ms;922 #else923 763 pReq = (VBOXSFCREATEREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq) + sf_i->path->u16Size); 924 764 if (!pReq) { … … 930 770 RT_ZERO(pReq->CreateParms); 931 771 pCreateParms = &pReq->CreateParms; 932 #endif933 772 pCreateParms->Handle = SHFL_HANDLE_NIL; 934 773 … … 981 820 982 821 pCreateParms->Info.Attr.fMode = inode->i_mode; 983 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE984 LogFunc(("sf_reg_open: calling VbglR0SfCreate, file %s, flags=%#x, %#x\n", sf_i->path->String.utf8, file->f_flags, pCreateParms->CreateFlags));985 rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path, pCreateParms);986 #else987 822 LogFunc(("sf_reg_open: calling VbglR0SfHostReqCreate, file %s, flags=%#x, %#x\n", sf_i->path->String.utf8, file->f_flags, pCreateParms->CreateFlags)); 988 823 rc = VbglR0SfHostReqCreate(sf_g->map.root, pReq); 989 #endif990 824 if (RT_FAILURE(rc)) { 991 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE992 LogFunc(("VbglR0SfCreate failed flags=%d,%#x rc=%Rrc\n", file->f_flags, pCreateParms->CreateFlags, rc));993 #else994 825 LogFunc(("VbglR0SfHostReqCreate failed flags=%d,%#x rc=%Rrc\n", file->f_flags, pCreateParms->CreateFlags, rc)); 995 #endif996 826 kfree(sf_r); 997 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE998 827 VbglR0PhysHeapFree(pReq); 999 #endif1000 828 return -RTErrConvertToErrno(rc); 1001 829 } … … 1019 847 sf_i->file = file; 1020 848 file->private_data = sf_r; 1021 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE1022 849 VbglR0PhysHeapFree(pReq); 1023 #endif1024 850 return rc_linux; 1025 851 } … … 1056 882 filemap_fdatawait(inode->i_mapping); 1057 883 #endif 1058 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE1059 rc = VbglR0SfClose(&client_handle, &sf_g->map, sf_r->handle);1060 if (RT_FAILURE(rc))1061 LogFunc(("VbglR0SfClose failed rc=%Rrc\n", rc));1062 #else1063 884 rc = VbglR0SfHostReqCloseSimple(sf_g->map.root, sf_r->handle); 1064 885 if (RT_FAILURE(rc)) 1065 886 LogFunc(("VbglR0SfHostReqCloseSimple failed rc=%Rrc\n", rc)); 1066 887 sf_r->handle = SHFL_HANDLE_NIL; 1067 #endif1068 888 1069 889 kfree(sf_r); … … 1270 1090 TRACE(); 1271 1091 1092 /** @todo rig up a FsPerf testcase for this code! */ 1093 1272 1094 if (page->index >= end_index) 1273 1095 nwritten = inode->i_size & (PAGE_SIZE - 1); … … 1319 1141 1320 1142 TRACE(); 1143 1144 /** @todo rig up a FsPerf testcase for this code! */ 1321 1145 1322 1146 buf = kmap(page); -
trunk/src/VBox/Additions/linux/sharedfolders/utils.c
r77250 r77303 189 189 { 190 190 int rc; 191 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE192 SHFLCREATEPARMS params;193 #else194 191 VBOXSFCREATEREQ *pReq; 195 #endif196 192 NOREF(caller); 197 193 198 194 TRACE(); 199 195 200 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE201 RT_ZERO(params);202 params.Handle = SHFL_HANDLE_NIL;203 params.CreateFlags = SHFL_CF_LOOKUP | SHFL_CF_ACT_FAIL_IF_NEW;204 LogFunc(("sf_stat: calling VbglR0SfCreate, file %s, flags %#x\n",205 path->String.utf8, params.CreateFlags));206 rc = VbglR0SfCreate(&client_handle, &sf_g->map, path, ¶ms);207 if (rc == VERR_INVALID_NAME) {208 /* this can happen for names like 'foo*' on a Windows host */209 return -ENOENT;210 }211 if (RT_FAILURE(rc)) {212 LogFunc(("VbglR0SfCreate(%s) failed. caller=%s, rc=%Rrc\n",213 path->String.utf8, rc, caller));214 return -EPROTO;215 }216 if (params.Result != SHFL_FILE_EXISTS) {217 if (!ok_to_fail)218 LogFunc(("VbglR0SfCreate(%s) file does not exist. caller=%s, result=%d\n", path->String.utf8, params.Result, caller));219 return -ENOENT;220 }221 222 *result = params.Info;223 return 0;224 #else225 196 pReq = (VBOXSFCREATEREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq) + path->u16Size); 226 197 if (pReq) { … … 253 224 rc = -ENOMEM; 254 225 return rc; 255 #endif256 226 } 257 227 … … 387 357 struct sf_glob_info *sf_g; 388 358 struct sf_inode_info *sf_i; 389 # ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE390 SHFLCREATEPARMS CreateParms;391 SHFLCREATEPARMS *pCreateParms = &CreateParms;392 SHFLFSOBJINFO InfoBuf;393 SHFLFSOBJINFO *pInfo = &InfoBuf;394 uint32_t cbBuffer;395 int rc, err;396 # else397 359 union SetAttrReqs 398 360 { … … 408 370 int vrc; 409 371 int err = 0; 410 # endif411 372 412 373 TRACE(); … … 414 375 sf_g = GET_GLOB_INFO(dentry->d_inode->i_sb); 415 376 sf_i = GET_INODE_INFO(dentry->d_inode); 416 # ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE417 err = 0;418 # else419 377 cbReq = RT_MAX(sizeof(pReq->Info), sizeof(pReq->Create) + SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size); 420 378 pReq = (union SetAttrReqs *)VbglR0PhysHeapAlloc(cbReq); … … 425 383 pCreateParms = &pReq->Create.CreateParms; 426 384 pInfo = &pReq->Info.ObjInfo; 427 # endif428 385 429 386 RT_ZERO(*pCreateParms); … … 437 394 pCreateParms->CreateFlags |= SHFL_CF_ACCESS_WRITE; 438 395 439 # ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE440 rc = VbglR0SfCreate(&client_handle, &sf_g->map, sf_i->path, pCreateParms);441 if (RT_FAILURE(rc)) {442 LogFunc(("VbglR0SfCreate(%s) failed rc=%Rrc\n",443 sf_i->path->String.utf8, rc));444 err = -RTErrConvertToErrno(rc);445 goto fail2;446 }447 # else448 396 memcpy(&pReq->Create.StrPath, sf_i->path, SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size); 449 397 vrc = VbglR0SfHostReqCreate(sf_g->map.root, &pReq->Create); … … 455 403 goto fail2; 456 404 } 457 # endif458 405 if (pCreateParms->Result != SHFL_FILE_EXISTS) { 459 406 LogFunc(("file %s does not exist\n", sf_i->path->String.utf8)); … … 494 441 /* ignore ctime (inode change time) as it can't be set from userland anyway */ 495 442 496 # ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE497 cbBuffer = sizeof(*pInfo);498 rc = VbglR0SfFsInfo(&client_handle, &sf_g->map, pCreateParms->Handle,499 SHFL_INFO_SET | SHFL_INFO_FILE, &cbBuffer,500 (PSHFLDIRINFO)pInfo);501 if (RT_FAILURE(rc)) {502 LogFunc(("VbglR0SfFsInfo(%s, FILE) failed rc=%Rrc\n",503 sf_i->path->String.utf8, rc));504 err = -RTErrConvertToErrno(rc);505 goto fail1;506 }507 # else508 443 vrc = VbglR0SfHostReqSetObjInfo(sf_g->map.root, &pReq->Info, hHostFile); 509 444 if (RT_FAILURE(vrc)) { … … 512 447 goto fail1; 513 448 } 514 # endif515 449 } 516 450 517 451 if (iattr->ia_valid & ATTR_SIZE) { 518 # ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE519 RT_ZERO(*pInfo);520 pInfo->cbObject = iattr->ia_size;521 cbBuffer = sizeof(*pInfo);522 rc = VbglR0SfFsInfo(&client_handle, &sf_g->map, pCreateParms->Handle,523 SHFL_INFO_SET | SHFL_INFO_SIZE, &cbBuffer,524 (PSHFLDIRINFO)pInfo);525 if (RT_FAILURE(rc)) {526 LogFunc(("VbglR0SfFsInfo(%s, SIZE) failed rc=%Rrc\n",527 sf_i->path->String.utf8, rc));528 err = -RTErrConvertToErrno(rc);529 goto fail1;530 }531 # else532 452 vrc = VbglR0SfHostReqSetFileSize(sf_g->map.root, &pReq->SetSize, hHostFile, iattr->ia_size); 533 453 /** @todo Implement fallback if host is < 6.0? */ … … 538 458 goto fail1; 539 459 } 540 # endif 541 } 542 543 # ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE 544 rc = VbglR0SfClose(&client_handle, &sf_g->map, pCreateParms->Handle); 545 if (RT_FAILURE(rc)) 546 LogFunc(("VbglR0SfClose(%s) failed rc=%Rrc\n", 547 sf_i->path->String.utf8, rc)); 548 # else 460 } 461 549 462 vrc = VbglR0SfHostReqClose(sf_g->map.root, &pReq->Close, hHostFile); 550 463 if (RT_FAILURE(vrc)) 551 464 LogFunc(("VbglR0SfHostReqClose(%s [%#llx]) failed vrc=%Rrc\n", sf_i->path->String.utf8, hHostFile, vrc)); 552 465 VbglR0PhysHeapFree(pReq); 553 # endif554 466 555 467 /** @todo r=bird: I guess we're calling revalidate here to update the inode … … 566 478 567 479 fail1: 568 # ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE569 rc = VbglR0SfClose(&client_handle, &sf_g->map, pCreateParms->Handle);570 if (RT_FAILURE(rc))571 LogFunc(("VbglR0SfClose(%s) failed rc=%Rrc\n",572 sf_i->path->String.utf8, rc));573 # else574 480 vrc = VbglR0SfHostReqClose(sf_g->map.root, &pReq->Close, hHostFile); 575 481 if (RT_FAILURE(vrc)) 576 482 LogFunc(("VbglR0SfHostReqClose(%s [%#llx]) failed vrc=%Rrc; err=%d\n", sf_i->path->String.utf8, hHostFile, vrc, err)); 577 # endif578 483 579 484 fail2: 580 # ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE581 485 VbglR0PhysHeapFree(pReq); 582 # endif583 486 return err; 584 487 } … … 895 798 int err; 896 799 SHFLSTRING *mask; 897 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE898 800 VBOXSFLISTDIRREQ *pReq = NULL; 899 #endif900 801 901 802 TRACE(); … … 903 804 if (err) 904 805 goto fail0; 905 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE906 806 pReq = (VBOXSFLISTDIRREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq)); 907 807 if (!pReq) 908 808 goto fail1; 909 #endif910 809 911 810 for (;;) { 912 811 int rc; 913 812 struct sf_dir_buf *b; 914 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE915 void *buf;916 uint32_t cbSize;917 uint32_t cEntries;918 #endif919 813 920 814 b = sf_get_empty_dir_buf(sf_d); … … 929 823 } 930 824 931 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE932 buf = b->buf;933 cbSize = b->cbFree;934 935 rc = VbglR0SfDirInfo(&client_handle, &sf_g->map, handle, mask,936 0, 0, &cbSize, buf, &cEntries);937 switch (rc) {938 case VINF_SUCCESS:939 RT_FALL_THRU();940 case VERR_NO_MORE_FILES:941 break;942 case VERR_NO_TRANSLATION:943 LogFunc(("host could not translate entry\n"));944 /* XXX */945 break;946 default:947 err = -RTErrConvertToErrno(rc);948 LogFunc(("VbglR0SfDirInfo failed rc=%Rrc\n", rc));949 goto fail2;950 }951 952 b->cEntries += cEntries;953 b->cbFree -= cbSize;954 b->cbUsed += cbSize;955 956 if (RT_FAILURE(rc))957 break;958 #else959 825 rc = VbglR0SfHostReqListDirContig2x(sf_g->map.root, pReq, handle, mask, virt_to_phys(mask), 960 826 0 /*fFlags*/, b->buf, virt_to_phys(b->buf), b->cbFree); … … 970 836 goto fail2; 971 837 } 972 #endif973 838 } 974 839 err = 0; 975 840 976 841 fail2: 977 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE978 842 VbglR0PhysHeapFree(pReq); 979 #endif980 843 fail1: 981 844 kfree(mask); … … 988 851 { 989 852 struct sf_glob_info *sf_g; 990 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE991 SHFLVOLINFO SHFLVolumeInfo;992 SHFLVOLINFO *pVolInfo = &SHFLVolumeInfo;993 uint32_t cbBuffer;994 #else995 853 VBOXSFVOLINFOREQ *pReq; 996 854 SHFLVOLINFO *pVolInfo; 997 #endif998 855 int rc; 999 856 1000 857 sf_g = GET_GLOB_INFO(sb); 1001 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE1002 cbBuffer = sizeof(SHFLVolumeInfo);1003 rc = VbglR0SfFsInfo(&client_handle, &sf_g->map, 0,1004 SHFL_INFO_GET | SHFL_INFO_VOLUME, &cbBuffer,1005 (PSHFLDIRINFO) & SHFLVolumeInfo);1006 #else1007 858 pReq = VbglR0PhysHeapAlloc(sizeof(*pReq)); 1008 859 if (pReq) { 1009 860 pVolInfo = &pReq->VolInfo; 1010 861 rc = VbglR0SfHostReqQueryVolInfo(sf_g->map.root, pReq, SHFL_HANDLE_ROOT); 1011 #endif1012 862 if (RT_SUCCESS(rc)) { 1013 863 stat->f_type = NFS_SUPER_MAGIC; /* XXX vboxsf type? */ … … 1035 885 } else 1036 886 rc = -RTErrConvertToErrno(rc); 1037 #ifndef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE1038 887 VbglR0PhysHeapFree(pReq); 1039 888 } else 1040 889 rc = -ENOMEM; 1041 #endif1042 890 return rc; 1043 891 } -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c
r77138 r77303 190 190 #undef _IS_EMPTY 191 191 192 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE193 rc = VbglR0SfMapFolder(&client_handle, str_name, &sf_g->map);194 #else195 192 rc = VbglR0SfHostReqMapFolderWithContigSimple(str_name, virt_to_phys(str_name), RTPATH_DELIMITER, 196 193 true /*fCaseSensitive*/, &sf_g->map.root); 197 #endif198 194 kfree(str_name); 199 195 … … 227 223 228 224 TRACE(); 229 #ifdef VBOXSF_USE_DEPRECATED_VBGL_INTERFACE230 rc = VbglR0SfUnmapFolder(&client_handle, &sf_g->map);231 if (RT_FAILURE(rc))232 LogFunc(("VbglR0SfUnmapFolder failed rc=%d\n", rc));233 #else234 225 rc = VbglR0SfHostReqUnmapFolderSimple(sf_g->map.root); 235 226 if (RT_FAILURE(rc)) 236 227 LogFunc(("VbglR0SfHostReqUnmapFolderSimple failed rc=%Rrc\n", rc)); 237 #endif238 228 239 229 if (sf_g->nls) -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h
r77138 r77303 34 34 # pragma once 35 35 #endif 36 37 /* VBOXSF_USE_DEPRECATED_VBGL_INTERFACE is also settable in make env. */38 /*#define VBOXSF_USE_DEPRECATED_VBGL_INTERFACE*/39 36 40 37 #define LOG_GROUP LOG_GROUP_SHARED_FOLDERS
Note:
See TracChangeset
for help on using the changeset viewer.