VirtualBox

Changeset 75678 in vbox for trunk/src/VBox/Additions/darwin


Ignore:
Timestamp:
Nov 22, 2018 9:39:48 PM (6 years ago)
Author:
vboxsync
Message:

darwin/VBoxSF: Updates.

Location:
trunk/src/VBox/Additions/darwin/VBoxSF
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/darwin/VBoxSF/Makefile.kmk

    r75677 r75678  
    5959
    6060#
    61 # mount.vboxvfs - The Shared Folders mouning tool.
     61# mount.vboxsf - The Shared Folders mounting tool.
    6262#
    6363PROGRAMS += mount.vboxsf
  • trunk/src/VBox/Additions/darwin/VBoxSF/VBoxSF-VNodeOps.cpp

    r75677 r75678  
    742742        VnParms.vnfs_dvp        = pParent;
    743743        VnParms.vnfs_fsnode     = pVnData;
    744         VnParms.vnfs_vops       = g_papfnVBoxVFSVnodeDirOpsVector;
     744        VnParms.vnfs_vops       = g_papfnVBoxSfDwnVnDirOpsVector;
    745745        VnParms.vnfs_markroot   = pParent == NULL;
    746746        VnParms.vnfs_marksystem = 0;
     
    821821
    822822/** ??? */
    823 int (**g_papfnVBoxVFSVnodeDirOpsVector)(void *);
     823int (**g_papfnVBoxSfDwnVnDirOpsVector)(void *);
    824824
    825825/**
     
    828828struct vnodeopv_desc g_VBoxSfVnodeOpvDesc =
    829829{
    830     &g_papfnVBoxVFSVnodeDirOpsVector,
     830    &g_papfnVBoxSfDwnVnDirOpsVector,
    831831    g_VBoxSfDirOpsDescList
    832832};
  • trunk/src/VBox/Additions/darwin/VBoxSF/VBoxSF-VfsOps.cpp

    r75677 r75678  
    2828#include <iprt/string.h>
    2929#include <VBox/log.h>
    30 
    31 
    32 /* States of VBoxVFS object used in atomic variables
    33  * in order to reach sync between several concurrently running threads. */
    34 #define VBOXVFS_OBJECT_UNINITIALIZED    (0)
    35 #define VBOXVFS_OBJECT_INITIALIZING     (1)
    36 #define VBOXVFS_OBJECT_INITIALIZED      (2)
    37 #define VBOXVFS_OBJECT_INVALID          (3)
    3830
    3931
     
    8476        pReq->Parms.pInfo.u.Embedded.fFlags     = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST;
    8577
    86         int vrc = VbglR0HGCMFastCall(g_SfClientDarwin.handle, &pReq->Hdr, sizeof(*pReq));
     78        int vrc = VbglR0HGCMFastCall(g_SfClientDarwin.handle, &pReq->Hdr, sizeof(*pReq));
    8779        if (RT_SUCCESS(vrc))
    8880            vrc = pReq->Call.header.result;
  • trunk/src/VBox/Additions/darwin/VBoxSF/VBoxSF.cpp

    r75677 r75678  
    4747uint32_t volatile               g_cVBoxSfMounts = 0;
    4848
    49 /* VBoxVFS filesystem handle. Needed for FS unregistering. */
     49/** VFS table entry for our file system (for vfs_fsremove). */
    5050static vfstable_t               g_pVBoxSfVfsTableEntry;
    5151/** For vfs_fsentry. */
     
    7878extern kern_return_t _stop(struct kmod_info *pKModInfo, void *pvData);
    7979
    80 KMOD_EXPLICIT_DECL(VBoxVFS, VBOX_VERSION_STRING, _start, _stop)
     80KMOD_EXPLICIT_DECL(VBoxSF, VBOX_VERSION_STRING, _start, _stop)
    8181DECLHIDDEN(kmod_start_func_t *) _realmain      = vboxSfDwnModuleLoad;
    8282DECLHIDDEN(kmod_stop_func_t *)  _antimain      = vboxSfDwnModuleUnload;
     
    212212
    213213    /*
    214      * Are we busy?  If so fail.
     214     * Are we busy?  If so fail.  Otherwise try deregister the file system.
    215215     */
    216216    if (g_cVBoxSfMounts > 0)
     
    220220    }
    221221
     222    if (g_pVBoxSfVfsTableEntry)
     223    {
     224        int rc = vfs_fsremove(g_pVBoxSfVfsTableEntry);
     225        if (rc != 0)
     226        {
     227            LogRel(("VBoxSF: vfs_fsremove failed: %d\n", rc));
     228            return KERN_NO_ACCESS;
     229        }
     230    }
     231
    222232    /*
    223233     * Disconnect and terminate libraries we're using.
    224234     */
    225 
    226235    if (g_SfClientDarwin.handle != NULL)
    227236    {
  • trunk/src/VBox/Additions/darwin/VBoxSF/VBoxSFInternal.h

    r75677 r75678  
    4848
    4949/*********************************************************************************************************************************
    50 *   Defined Constants And Macros                                                                                                 *
    51 *********************************************************************************************************************************/
    52 
    53 
    54 /*********************************************************************************************************************************
    5550*   Structures and Typedefs                                                                                                      *
    5651*********************************************************************************************************************************/
     
    7772typedef struct VBOXSFDWNVNDATA
    7873{
    79     SHFLHANDLE      hHandle;                /** VBoxVFS object handle. */
     74    /** The handle to the host object.  */
     75    SHFLHANDLE      hHandle;
    8076    ///PSHFLSTRING     pPath;                  /** Path within shared folder */
    8177    ///lck_attr_t     *pLockAttr;              /** BSD locking stuff */
     
    9490extern struct vfsops        g_VBoxSfVfsOps;
    9591extern struct vnodeopv_desc g_VBoxSfVnodeOpvDesc;
    96 extern int (**g_papfnVBoxVFSVnodeDirOpsVector)(void *);
     92extern int (**g_papfnVBoxSfDwnVnDirOpsVector)(void *);
    9793
    9894
     
    105101
    106102
    107 #if 0 /* old code, rewriting. */
    108 
    109 /**
    110  * Helper function to create XNU VFS vnode object.
    111  *
    112  * @param mp        Mount data structure
    113  * @param type      vnode type (directory, regular file, etc)
    114  * @param pParent   Parent vnode object (NULL for VBoxVFS root vnode)
    115  * @param fIsRoot   Flag that indicates if created vnode object is
    116  *                  VBoxVFS root vnode (TRUE for VBoxVFS root vnode, FALSE
    117  *                  for all aother vnodes)
    118  * @param           Path within Shared Folder
    119  * @param ret       Returned newly created vnode
    120  *
    121  * @return 0 on success, error code otherwise
    122  */
    123 extern int vboxvfs_create_vnode_internal(struct mount *mp, enum vtype type, vnode_t pParent, int fIsRoot, PSHFLSTRING Path, vnode_t *ret);
    124 
    125 /**
    126  * Convert guest absolute VFS path (starting from VFS root) to a host path
    127  * within mounted shared folder (returning it as a char *).
    128  *
    129  * @param mp            Mount data structure
    130  * @param pszGuestPath  Guest absolute VFS path (starting from VFS root)
    131  * @param cbGuestPath   Size of pszGuestPath
    132  * @param pszHostPath   Returned char * wich contains host path
    133  * @param cbHostPath    Returned pszHostPath size
    134  *
    135  * @return 0 on success, error code otherwise
    136  */
    137 extern int vboxvfs_guest_path_to_char_path_internal(mount_t mp, char *pszGuestPath, int cbGuestPath, char **pszHostPath, int *cbHostPath);
    138 
    139 /**
    140  * Convert guest absolute VFS path (starting from VFS root) to a host path
    141  * within mounted shared folder.
    142  *
    143  * @param mp            Mount data structure
    144  * @param pszGuestPath  Guest absolute VFS path (starting from VFS root)
    145  * @param cbGuestPath   Size of pszGuestPath
    146  * @param ppResult      Returned PSHFLSTRING object wich contains host path
    147  *
    148  * @return 0 on success, error code otherwise
    149  */
    150 extern int vboxvfs_guest_path_to_shflstring_path_internal(mount_t mp, char *pszGuestPath, int cbGuestPath, PSHFLSTRING *ppResult);
    151 
    152 /**
    153  * Wrapper function for vboxvfs_guest_path_to_char_path_internal() which
    154  * converts guest path to host path using vnode object information.
    155  *
    156  * @param vnode     Guest's VFS object
    157  * @param ppPath    Allocated  char * which contain a path
    158  * @param pcbPath   Size of ppPath
    159  *
    160  * @return 0 on success, error code otherwise.
    161  */
    162 extern int vboxvfs_guest_vnode_to_char_path_internal(vnode_t vnode, char **ppHostPath, int *pcbHostPath);
    163 
    164 /**
    165  * Wrapper function for vboxvfs_guest_path_to_shflstring_path_internal() which
    166  * converts guest path to host path using vnode object information.
    167  *
    168  * @param vnode     Guest's VFS object
    169  * @param ppResult  Allocated  PSHFLSTRING object which contain a path
    170  *
    171  * @return 0 on success, error code otherwise.
    172  */
    173 extern int vboxvfs_guest_vnode_to_shflstring_path_internal(vnode_t vnode, PSHFLSTRING *ppResult);
    174 
    175 /**
    176  * Free resources allocated by vboxvfs_path_internal() and vboxvfs_guest_vnode_to_shflstring_path_internal().
    177  *
    178  * @param ppHandle  Reference to object to be freed.
    179  */
    180 extern void vboxvfs_put_path_internal(void **ppHandle);
    181 
    182 /**
    183  * Open existing VBoxVFS object and return its handle.
    184  *
    185  * @param pMount            Mount session data.
    186  * @param pPath             VFS path to the object relative to mount point.
    187  * @param fFlags            For directory object it should be
    188  *                          SHFL_CF_DIRECTORY and 0 for any other object.
    189  * @param pHandle           Returned handle.
    190  *
    191  * @return 0 on success, error code otherwise.
    192  */
    193 extern int vboxvfs_open_internal(vboxvfs_mount_t *pMount, PSHFLSTRING pPath, uint32_t fFlags, SHFLHANDLE *pHandle);
    194 
    195 /**
    196  * Release VBoxVFS object handle openned by vboxvfs_open_internal().
    197  *
    198  * @param pMount            Mount session data.
    199  * @param pHandle           Handle to close.
    200  *
    201  * @return 0 on success, IPRT error code otherwise.
    202  */
    203 extern int vboxvfs_close_internal(vboxvfs_mount_t *pMount, SHFLHANDLE pHandle);
    204 
    205 /**
    206  * Get information about host VFS object.
    207  *
    208  * @param mp           Mount point data
    209  * @param pSHFLDPath   Path to VFS object within mounted shared folder
    210  * @param Info         Returned info
    211  *
    212  * @return  0 on success, error code otherwise.
    213  */
    214 extern int vboxvfs_get_info_internal(mount_t mp, PSHFLSTRING pSHFLDPath, PSHFLFSOBJINFO Info);
    215 
    216 /**
    217  * Check if VFS object exists on a host side.
    218  *
    219  * @param vnode     Guest VFS vnode that corresponds to host VFS object
    220  *
    221  * @return 1 if exists, 0 otherwise.
    222  */
    223 extern int vboxvfs_exist_internal(vnode_t vnode);
    224 
    225 /**
    226  * Convert host VFS object mode flags into guest ones.
    227  *
    228  * @param fHostMode     Host flags
    229  *
    230  * @return Guest flags
    231  */
    232 extern mode_t vboxvfs_h2g_mode_inernal(RTFMODE fHostMode);
    233 
    234 /**
    235  * Convert guest VFS object mode flags into host ones.
    236  *
    237  * @param fGuestMode     Host flags
    238  *
    239  * @return Host flags
    240  */
    241 extern uint32_t vboxvfs_g2h_mode_inernal(mode_t fGuestMode);
    242 
    243 extern SHFLSTRING *vboxvfs_construct_shflstring(const char *pszName, size_t cchName);
    244103#endif
    245104
    246 #endif
    247 
    248 
  • trunk/src/VBox/Additions/darwin/VBoxSF/VBoxSFMount.h

    r75293 r75678  
    2727 * Mount information that gets passed from userland on mount.
    2828 */
    29 typedef struct vboxvfs_mount_info
     29typedef struct VBOXSFDRWNMOUNTINFO
    3030{
    31     /** Magic value (VBOXVFS_MOUNTINFO_MAGIC).   */
     31    /** Magic value (VBOXSFDRWNMOUNTINFO_MAGIC).   */
    3232    uint32_t    u32Magic;
    3333    /** The shared folder name.   */
Note: See TracChangeset for help on using the changeset viewer.

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