Changeset 77854 in vbox for trunk/src/VBox
- Timestamp:
- Mar 22, 2019 10:23:36 PM (6 years ago)
- Location:
- trunk/src/VBox/Additions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibSharedFolders.c
r77304 r77854 51 51 * Defined Constants And Macros * 52 52 *********************************************************************************************************************************/ 53 #define SHFL_CPARMS_SET_UTF8 054 #define SHFL_CPARMS_SET_SYMLINKS 055 56 53 #define VBOX_INIT_CALL(a, b, c) \ 57 54 LogFunc(("%s, idClient=%d\n", "SHFL_FN_" # b, (c)->idClient)); \ … … 101 98 } 102 99 100 #if !defined(RT_OS_LINUX) 101 103 102 DECLVBGL(int) VbglR0SfSetUtf8(PVBGLSFCLIENT pClient) 104 103 { … … 111 110 return rc; 112 111 } 113 114 #if !defined(RT_OS_LINUX)115 112 116 113 /** @name Deprecated VBGL shared folder helpers. … … 393 390 } 394 391 395 #endif /* !RT_OS_LINUX */396 397 392 DECLVBGL(int) VbglR0SfWrite(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile, 398 393 uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked) … … 425 420 return rc; 426 421 } 427 428 #ifndef RT_OS_LINUX429 422 430 423 DECLVBGL(int) VbglR0SfWritePhysCont(PVBGLSFCLIENT pClient, PVBGLSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, … … 697 690 } 698 691 692 #if !defined(RT_OS_LINUX) 693 699 694 DECLVBGL(int) VbglR0SfSetSymlinks(PVBGLSFCLIENT pClient) 700 695 { … … 708 703 } 709 704 705 #endif /* !RT_OS_LINUX */ 710 706 711 707 /** @} */ -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c
r77853 r77854 53 53 #include <linux/seq_file.h> 54 54 #include <linux/vfs.h> 55 #include < iprt/err.h>55 #include <VBox/err.h> 56 56 #include <iprt/path.h> 57 57 … … 75 75 76 76 /* forward declaration */ 77 static struct super_operations sf_super_ops;77 static struct super_operations g_vbsf_super_ops; 78 78 79 79 … … 503 503 # endif 504 504 #endif 505 sb->s_op = & sf_super_ops;505 sb->s_op = &g_vbsf_super_ops; 506 506 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) 507 507 sb->s_d_op = &vbsf_dentry_ops; … … 723 723 * Super block operations. 724 724 */ 725 static struct super_operations sf_super_ops = {725 static struct super_operations g_vbsf_super_ops = { 726 726 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) 727 .clear_inode = vbsf_clear_inode,727 .clear_inode = vbsf_clear_inode, 728 728 #else 729 .evict_inode = vbsf_evict_inode,729 .evict_inode = vbsf_evict_inode, 730 730 #endif 731 731 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) 732 .read_inode = vbsf_read_inode,733 #endif 734 .put_super = vbsf_put_super,735 .statfs = vbsf_statfs,736 .remount_fs = vbsf_remount_fs,732 .read_inode = vbsf_read_inode, 733 #endif 734 .put_super = vbsf_put_super, 735 .statfs = vbsf_statfs, 736 .remount_fs = vbsf_remount_fs, 737 737 .show_options = vbsf_show_options 738 738 }; 739 739 740 740 741 /* 742 * File system type related stuff. 743 */ 741 742 /********************************************************************************************************************************* 743 * File system type related stuff. * 744 *********************************************************************************************************************************/ 744 745 745 746 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 4) … … 777 778 # endif /* LINUX_VERSION_CODE >= 2.6.39 */ 778 779 779 static struct file_system_type vboxsf_fs_type = { 780 /** 781 * File system registration structure. 782 */ 783 static struct file_system_type g_vboxsf_fs_type = { 780 784 .owner = THIS_MODULE, 781 785 .name = "vboxsf", … … 804 808 } 805 809 806 static DECLARE_FSTYPE( vboxsf_fs_type, "vboxsf", vbsf_read_super_24, 0);810 static DECLARE_FSTYPE(g_vboxsf_fs_type, "vboxsf", vbsf_read_super_24, 0); 807 811 808 812 #endif /* LINUX_VERSION_CODE < 2.5.4 */ 809 813 810 814 811 /* Module initialization/finalization handlers */ 815 816 /********************************************************************************************************************************* 817 * Module stuff * 818 *********************************************************************************************************************************/ 819 820 /** 821 * Called on module initialization. 822 */ 812 823 static int __init init(void) 813 824 { 814 int rc Ret = 0;815 int vrc;816 int err; 817 818 TRACE();819 825 int rc; 826 SFLOGFLOW(("vboxsf: init\n")); 827 828 /* 829 * Must be paranoid about the vbsf_mount_info_new size. 830 */ 820 831 AssertCompile(sizeof(struct vbsf_mount_info_new) <= PAGE_SIZE); 821 832 if (sizeof(struct vbsf_mount_info_new) > PAGE_SIZE) { 822 833 printk(KERN_ERR 823 " Mount information structure is too large %lu\n"824 " Must be less than or equal to %lu\n",834 "vboxsf: Mount information structure is too large %lu\n" 835 "vboxsf: Must be less than or equal to %lu\n", 825 836 (unsigned long)sizeof(struct vbsf_mount_info_new), 826 837 (unsigned long)PAGE_SIZE); … … 828 839 } 829 840 830 /** @todo Init order is wrong, file system reigstration is the very last 831 * thing we should do. */ 841 /* 842 * Initialize stuff. 843 */ 832 844 spin_lock_init(&g_SfHandleLock); 833 err = register_filesystem(&vboxsf_fs_type); 834 if (err) { 835 LogFunc(("register_filesystem err=%d\n", err)); 836 return err; 837 } 838 839 vrc = VbglR0SfInit(); 840 if (RT_FAILURE(vrc)) { 841 LogRelFunc(("VbglR0SfInit failed, vrc=%Rrc\n", vrc)); 842 rcRet = -EPROTO; 843 goto fail0; 844 } 845 846 vrc = VbglR0SfConnect(&g_SfClient); 847 if (RT_FAILURE(vrc)) { 848 LogRelFunc(("VbglR0SfConnect failed, vrc=%Rrc\n", vrc)); 849 rcRet = -EPROTO; 850 goto fail1; 851 } 852 853 vrc = VbglR0QueryHostFeatures(&g_fHostFeatures); 854 if (RT_FAILURE(vrc)) 855 { 856 LogRelFunc(("VbglR0QueryHostFeatures failed: vrc=%Rrc (ignored)\n", vrc)); 857 g_fHostFeatures = 0; 858 } 859 860 VbglR0SfHostReqQueryFeaturesSimple(&g_fSfFeatures, &g_uSfLastFunction); 861 LogRelFunc(("g_fHostFeatures=%#x g_fSfFeatures=%#RX64 g_uSfLastFunction=%u\n", 862 g_fHostFeatures, g_fSfFeatures, g_uSfLastFunction)); 863 864 vrc = VbglR0SfSetUtf8(&g_SfClient); 865 if (RT_FAILURE(vrc)) { 866 LogRelFunc(("VbglR0SfSetUtf8 failed, vrc=%Rrc\n", vrc)); 867 rcRet = -EPROTO; 868 goto fail2; 869 } 845 rc = VbglR0SfInit(); 846 if (RT_SUCCESS(rc)) { 847 /* 848 * Try connect to the shared folder HGCM service. 849 * It is possible it is not there. 850 */ 851 rc = VbglR0SfConnect(&g_SfClient); 852 if (RT_SUCCESS(rc)) { 853 /* 854 * Query host HGCM features and afterwards (must be last) shared folder features. 855 */ 856 rc = VbglR0QueryHostFeatures(&g_fHostFeatures); 857 if (RT_FAILURE(rc)) 858 { 859 LogRel(("vboxsf: VbglR0QueryHostFeatures failed: rc=%Rrc (ignored)\n", rc)); 860 g_fHostFeatures = 0; 861 } 862 VbglR0SfHostReqQueryFeaturesSimple(&g_fSfFeatures, &g_uSfLastFunction); 863 LogRel(("vboxsf: g_fHostFeatures=%#x g_fSfFeatures=%#RX64 g_uSfLastFunction=%u\n", 864 g_fHostFeatures, g_fSfFeatures, g_uSfLastFunction)); 865 866 /* 867 * Tell the shared folder service about our expectations: 868 * - UTF-8 strings (rather than UTF-16) 869 * - Wheter to return or follow (default) symbolic links. 870 */ 871 rc = VbglR0SfHostReqSetUtf8Simple(); 872 if (RT_SUCCESS(rc)) { 870 873 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 871 if (!g_fFollowSymlinks) { 872 vrc = VbglR0SfSetSymlinks(&g_SfClient); 873 if (RT_FAILURE(vrc)) { 874 printk(KERN_WARNING 875 "vboxsf: Host unable to show symlinks, vrc=%d\n", 876 vrc); 874 if (!g_fFollowSymlinks) { 875 rc = VbglR0SfHostReqSetSymlinksSimple(); 876 if (RT_FAILURE(rc)) 877 printk(KERN_WARNING "vboxsf: Host unable to show symlinks, rc=%d\n", rc); 878 } 879 #endif 880 /* 881 * Now that we're ready for action, try register the 882 * file system with the kernel. 883 */ 884 rc = register_filesystem(&g_vboxsf_fs_type); 885 if (rc == 0) { 886 printk(KERN_INFO "vboxsf: Successfully loaded version " VBOX_VERSION_STRING "\n"); 887 return 0; 888 } 889 890 /* 891 * Failed. Bail out. 892 */ 893 LogRel(("vboxsf: register_filesystem failed: rc=%d\n", rc)); 894 } else { 895 LogRel(("vboxsf: VbglR0SfSetUtf8 failed, rc=%Rrc\n", rc)); 896 rc = -EPROTO; 897 } 898 VbglR0SfDisconnect(&g_SfClient); 899 } else { 900 LogRel(("vboxsf: VbglR0SfConnect failed, rc=%Rrc\n", rc)); 901 rc = rc == VERR_HGCM_SERVICE_NOT_FOUND ? -EHOSTDOWN : -ECONNREFUSED; 877 902 } 878 } 879 #endif 880 881 printk(KERN_DEBUG 882 "vboxsf: Successfully loaded version " VBOX_VERSION_STRING 883 " (interface " RT_XSTR(VMMDEV_VERSION) ")\n"); 884 885 return 0; 886 887 fail2: 888 VbglR0SfDisconnect(&g_SfClient); 889 890 fail1: 891 VbglR0SfTerm(); 892 893 fail0: 894 unregister_filesystem(&vboxsf_fs_type); 895 return rcRet; 896 } 897 903 VbglR0SfTerm(); 904 } else { 905 LogRel(("vboxsf: VbglR0SfInit failed, rc=%Rrc\n", rc)); 906 rc = -EPROTO; 907 } 908 return rc; 909 } 910 911 912 /** 913 * Called on module finalization. 914 */ 898 915 static void __exit fini(void) 899 916 { 900 TRACE(); 901 917 SFLOGFLOW(("vboxsf: fini\n")); 918 919 unregister_filesystem(&g_vboxsf_fs_type); 902 920 VbglR0SfDisconnect(&g_SfClient); 903 921 VbglR0SfTerm(); 904 unregister_filesystem(&vboxsf_fs_type);905 922 } 906 923
Note:
See TracChangeset
for help on using the changeset viewer.