VirtualBox

Changeset 77529 in vbox for trunk


Ignore:
Timestamp:
Mar 1, 2019 2:13:40 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129132
Message:

linux/vboxsf: Use vbxsf as prefix here - part I. bugref:9172

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

Legend:

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

    r77526 r77529  
    3939 *       reading in the whole directory on open.
    4040 */
    41 static int sf_dir_open_worker(struct vbsf_super_info *sf_g, struct sf_dir_info *sf_d,
    42                               struct sf_inode_info *sf_i, const char *pszCaller)
     41static int vbsf_dir_open_worker(struct vbsf_super_info *sf_g, struct sf_dir_info *sf_d,
     42                                struct sf_inode_info *sf_i, const char *pszCaller)
    4343{
    4444    int rc;
     
    8484            /** @todo Reading all entries upon opening the directory doesn't seem like
    8585             * a good idea. */
    86             sf_dir_info_empty(sf_d);
    87             err = sf_dir_read_all(sf_g, sf_i, sf_d, pCreateParms->Handle);
     86            vbsf_dir_info_empty(sf_d);
     87            err = vbsf_dir_read_all(sf_g, sf_i, sf_d, pCreateParms->Handle);
    8888        } else
    8989            err = -ENOENT;
     
    111111 * @returns 0 on success, Linux error code otherwise
    112112 */
    113 static int sf_dir_open(struct inode *inode, struct file *file)
     113static int vbsf_dir_open(struct inode *inode, struct file *file)
    114114{
    115115    struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
     
    127127    }
    128128
    129     sf_d = sf_dir_info_alloc();
     129    sf_d = vbsf_dir_info_alloc();
    130130    if (!sf_d) {
    131131        LogRelFunc(("could not allocate directory info for '%s'\n", sf_i->path->String.ach));
     
    133133    }
    134134
    135     err = sf_dir_open_worker(sf_g, sf_d, sf_i, "sf_dir_open");
     135    err = vbsf_dir_open_worker(sf_g, sf_d, sf_i, "vbsf_dir_open");
    136136    if (!err)
    137137        file->private_data = sf_d;
    138138    else
    139         sf_dir_info_free(sf_d);
     139        vbsf_dir_info_free(sf_d);
    140140
    141141    return err;
     
    151151 * returns 0 on success, Linux error code otherwise
    152152 */
    153 static int sf_dir_release(struct inode *inode, struct file *file)
     153static int vbsf_dir_release(struct inode *inode, struct file *file)
    154154{
    155155    TRACE();
    156156
    157157    if (file->private_data)
    158         sf_dir_info_free(file->private_data);
     158        vbsf_dir_info_free(file->private_data);
    159159
    160160    return 0;
     
    166166 * returns d_type
    167167 */
    168 static int sf_get_d_type(RTFMODE fMode)
     168static int vbsf_get_d_type(RTFMODE fMode)
    169169{
    170170    int d_type;
     
    206206 * @returns 0 for success, 1 for end reached, Linux error code otherwise.
    207207 */
    208 static int sf_getdent(struct file *dir, char d_name[NAME_MAX], int *d_type)
     208static int vbsf_getdent(struct file *dir, char d_name[NAME_MAX], int *d_type)
    209209{
    210210    loff_t cur;
     
    227227
    228228    if (sf_i->force_reread) {
    229         int err = sf_dir_open_worker(sf_g, sf_d, sf_i, "sf_getdent");
     229        int err = vbsf_dir_open_worker(sf_g, sf_d, sf_i, "vbsf_getdent");
    230230        if (!err) {
    231231            sf_i->force_reread = 0;
    232232        } else {
    233233            if (err == -ENOENT) {
    234                 sf_dir_info_free(sf_d);
     234                vbsf_dir_info_free(sf_d);
    235235                dir->private_data = NULL;
    236236            }
     
    260260        }
    261261
    262         *d_type = sf_get_d_type(info->Info.Attr.fMode);
    263 
    264         return sf_nlscpy(sf_g, d_name, NAME_MAX,
     262        *d_type = vbsf_get_d_type(info->Info.Attr.fMode);
     263
     264        return vbsf_nlscpy(sf_g, d_name, NAME_MAX,
    265265                 info->name.String.utf8, info->name.u16Length);
    266266    }
     
    274274 * [filldir]. [filldir] magically modifies it's argument - [opaque]
    275275 * and takes following additional arguments (which i in turn get from
    276  * the host via sf_getdent):
     276 * the host via vbsf_getdent):
    277277 *
    278278 * name : name of the entry (i must also supply it's length huh?)
     
    288288 * along the way) and feed them to [filldir] until:
    289289 *
    290  * a. there are no more entries (i.e. sf_getdent set done to 1)
     290 * a. there are no more entries (i.e. vbsf_getdent set done to 1)
    291291 * b. failure to compute fake inode number
    292292 * c. filldir returns an error (see comment on that)
    293293 */
    294294#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
    295 static int sf_dir_iterate(struct file *dir, struct dir_context *ctx)
     295static int vbsf_dir_iterate(struct file *dir, struct dir_context *ctx)
    296296#else
    297 static int sf_dir_read(struct file *dir, void *opaque, filldir_t filldir)
     297static int vbsf_dir_read(struct file *dir, void *opaque, filldir_t filldir)
    298298#endif
    299299{
     
    306306        int d_type = DT_UNKNOWN;
    307307
    308         err = sf_getdent(dir, d_name, &d_type);
     308        err = vbsf_getdent(dir, d_name, &d_type);
    309309        switch (err) {
    310310        case 1:
     
    317317        default:
    318318            /* skip erroneous entry and proceed */
    319             LogFunc(("sf_getdent error %d\n", err));
     319            LogFunc(("vbsf_getdent error %d\n", err));
    320320            dir->f_pos += 1;
    321321#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
     
    362362}
    363363
    364 struct file_operations sf_dir_fops = {
    365     .open = sf_dir_open,
     364struct file_operations vbsf_dir_fops = {
     365    .open = vbsf_dir_open,
    366366#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
    367     .iterate = sf_dir_iterate,
     367    .iterate = vbsf_dir_iterate,
    368368#else
    369     .readdir = sf_dir_read,
    370 #endif
    371     .release = sf_dir_release,
     369    .readdir = vbsf_dir_read,
     370#endif
     371    .release = vbsf_dir_release,
    372372    .read = generic_read_dir
    373373#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
     
    379379
    380380/**
    381  * Worker for sf_lookup() and sf_instantiate().
    382  */
    383 static struct inode *sf_create_inode(struct inode *parent, struct dentry *dentry, PSHFLSTRING path,
    384                                      PSHFLFSOBJINFO pObjInfo, struct vbsf_super_info *sf_g, bool fInstantiate)
     381 * Worker for vbsf_inode_lookup() and vbsf_inode_instantiate().
     382 */
     383static struct inode *vbsf_create_inode(struct inode *parent, struct dentry *dentry, PSHFLSTRING path,
     384                                       PSHFLFSOBJINFO pObjInfo, struct vbsf_super_info *sf_g, bool fInstantiate)
    385385{
    386386    /*
     
    410410
    411411            SET_INODE_INFO(pInode, sf_new_i);
    412             sf_init_inode(pInode, sf_new_i, pObjInfo, sf_g);
     412            vbsf_init_inode(pInode, sf_new_i, pObjInfo, sf_g);
    413413
    414414            /*
     
    439439 * returned in case of success and "negative" pointer on error
    440440 */
    441 static struct dentry *sf_lookup(struct inode *parent, struct dentry *dentry
     441static struct dentry *vbsf_inode_lookup(struct inode *parent, struct dentry *dentry
    442442#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
    443                                 , unsigned int flags
     443                                        , unsigned int flags
    444444#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    445                                 , struct nameidata *nd
    446 #endif
    447                                 )
     445                                        , struct nameidata *nd
     446#endif
     447                                        )
    448448{
    449449    struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(parent->i_sb);
     
    454454
    455455#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
    456     SFLOGFLOW(("sf_lookup: parent=%p dentry=%p flags=%#x\n", parent, dentry, flags));
     456    SFLOGFLOW(("vbsf_inode_lookup: parent=%p dentry=%p flags=%#x\n", parent, dentry, flags));
    457457#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    458     SFLOGFLOW(("sf_lookup: parent=%p dentry=%p nd=%p{.flags=%#x}\n", parent, dentry, nd, nd ? nd->flags : 0));
     458    SFLOGFLOW(("vbsf_inode_lookup: parent=%p dentry=%p nd=%p{.flags=%#x}\n", parent, dentry, nd, nd ? nd->flags : 0));
    459459#else
    460     SFLOGFLOW(("sf_lookup: parent=%p dentry=%p\n", parent, dentry));
     460    SFLOGFLOW(("vbsf_inode_lookup: parent=%p dentry=%p\n", parent, dentry));
    461461#endif
    462462
     
    467467     * Build the path.  We'll associate the path with dret's inode on success.
    468468     */
    469     rc = sf_path_from_dentry(__func__, sf_g, sf_i, dentry, &path);
     469    rc = vbsf_path_from_dentry(__func__, sf_g, sf_i, dentry, &path);
    470470    if (rc == 0) {
    471471        /*
     
    489489                     * the existence of all parent dentries, we increase their TTL.
    490490                     */
    491                     pInode = sf_create_inode(parent, dentry, path, &pReq->CreateParms.Info, sf_g, false /*fInstantiate*/);
     491                    pInode = vbsf_create_inode(parent, dentry, path, &pReq->CreateParms.Info, sf_g, false /*fInstantiate*/);
    492492                    if (rc == 0) {
    493493                        path = NULL; /* given to the inode */
     
    495495                    } else
    496496                        dret = (struct dentry *)ERR_PTR(-ENOMEM);
    497                     sf_dentry_chain_increase_parent_ttl(dentry);
     497                    vbsf_dentry_chain_increase_parent_ttl(dentry);
    498498                } else if (   pReq->CreateParms.Result == SHFL_FILE_NOT_FOUND
    499499                       || pReq->CreateParms.Result == SHFL_PATH_NOT_FOUND /*this probably should happen*/) {
     
    516516             */
    517517            if (dret == dentry) {
    518                 sf_dentry_set_update_jiffies(dentry, jiffies);
     518                vbsf_dentry_set_update_jiffies(dentry, jiffies);
    519519#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
    520                 Assert(dentry->d_op == &sf_dentry_ops); /* (taken from the superblock) */
     520                Assert(dentry->d_op == &vbsf_dentry_ops); /* (taken from the superblock) */
    521521#else
    522                 dentry->d_op = &sf_dentry_ops;
     522                dentry->d_op = &vbsf_dentry_ops;
    523523#endif
    524524                d_add(dentry, pInode);
     
    546546 * @returns 0 on success, Linux error code otherwise
    547547 */
    548 static int sf_instantiate(struct inode *parent, struct dentry *dentry, PSHFLSTRING path, PSHFLFSOBJINFO info, SHFLHANDLE handle)
     548static int vbsf_inode_instantiate(struct inode *parent, struct dentry *dentry, PSHFLSTRING path,
     549                                  PSHFLFSOBJINFO info, SHFLHANDLE handle)
    549550{
    550551    struct vbsf_super_info *sf_g   = VBSF_GET_SUPER_INFO(parent->i_sb);
    551     struct inode           *pInode = sf_create_inode(parent, dentry, path, info, sf_g, true /*fInstantiate*/);
     552    struct inode           *pInode = vbsf_create_inode(parent, dentry, path, info, sf_g, true /*fInstantiate*/);
    552553    if (pInode) {
    553554        /* Store this handle if we leave the handle open. */
     
    568569 * @returns 0 on success, Linux error code otherwise
    569570 */
    570 static int sf_create_aux(struct inode *parent, struct dentry *dentry, umode_t mode, int fDirectory)
     571static int vbsf_create_worker(struct inode *parent, struct dentry *dentry, umode_t mode, int fDirectory)
    571572{
    572573    int rc, err;
     
    585586    BUG_ON(!sf_g);
    586587
    587     err = sf_path_from_dentry(__func__, sf_g, sf_parent_i, dentry, &path);
     588    err = vbsf_path_from_dentry(__func__, sf_g, sf_parent_i, dentry, &path);
    588589    if (err)
    589590        goto fail0;
    590591
    591     /** @todo combine with sf_path_from_dentry? */
     592    /** @todo combine with vbsf_path_from_dentry? */
    592593    pReq = (union CreateAuxReq *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath.String) + path->u16Size);
    593594    if (pReq) {
     
    629630    }
    630631
    631     sf_dentry_chain_increase_parent_ttl(dentry);
    632 
    633     err = sf_instantiate(parent, dentry, path, &pCreateParms->Info,
     632    vbsf_dentry_chain_increase_parent_ttl(dentry);
     633
     634    err = vbsf_inode_instantiate(parent, dentry, path, &pCreateParms->Info,
    634635                 fDirectory ? SHFL_HANDLE_NIL : pCreateParms->Handle);
    635636    if (err) {
     
    640641    /*
    641642     * Don't close this handle right now. We assume that the same file is
    642      * opened with sf_reg_open() and later closed with sf_reg_close(). Save
     643     * opened with vbsf_reg_open() and later closed with sf_reg_close(). Save
    643644     * the handle in between. Does not apply to directories. True?
    644645     */
     
    677678 */
    678679#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) || defined(DOXYGEN_RUNNING)
    679 static int sf_create(struct inode *parent, struct dentry *dentry, umode_t mode, bool excl)
     680static int vbsf_inode_create(struct inode *parent, struct dentry *dentry, umode_t mode, bool excl)
    680681#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
    681 static int sf_create(struct inode *parent, struct dentry *dentry, umode_t mode, struct nameidata *nd)
     682static int vbsf_inode_create(struct inode *parent, struct dentry *dentry, umode_t mode, struct nameidata *nd)
    682683#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    683 static int sf_create(struct inode *parent, struct dentry *dentry, int mode, struct nameidata *nd)
     684static int vbsf_inode_create(struct inode *parent, struct dentry *dentry, int mode, struct nameidata *nd)
    684685#else
    685 static int sf_create(struct inode *parent, struct dentry *dentry, int mode)
     686static int vbsf_inode_create(struct inode *parent, struct dentry *dentry, int mode)
    686687#endif
    687688{
     
    690691 *        changed (investigate)... */
    691692    TRACE();
    692     return sf_create_aux(parent, dentry, mode, 0 /*fDirectory*/);
     693    return vbsf_create_worker(parent, dentry, mode, 0 /*fDirectory*/);
    693694}
    694695
     
    702703 */
    703704#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
    704 static int sf_mkdir(struct inode *parent, struct dentry *dentry, umode_t mode)
     705static int vbsf_inode_mkdir(struct inode *parent, struct dentry *dentry, umode_t mode)
    705706#else
    706 static int sf_mkdir(struct inode *parent, struct dentry *dentry, int mode)
    707 #endif
    708 {
    709     TRACE();
    710     return sf_create_aux(parent, dentry, mode, 1 /*fDirectory*/);
     707static int vbsf_inode_mkdir(struct inode *parent, struct dentry *dentry, int mode)
     708#endif
     709{
     710    TRACE();
     711    return vbsf_create_worker(parent, dentry, mode, 1 /*fDirectory*/);
    711712}
    712713
     
    719720 * @returns 0 on success, Linux error code otherwise
    720721 */
    721 static int sf_unlink_aux(struct inode *parent, struct dentry *dentry, int fDirectory)
     722static int vbsf_unlink_worker(struct inode *parent, struct dentry *dentry, int fDirectory)
    722723{
    723724    int rc, err;
     
    729730    BUG_ON(!sf_g);
    730731
    731     err = sf_path_from_dentry(__func__, sf_g, sf_parent_i, dentry, &path);
     732    err = vbsf_path_from_dentry(__func__, sf_g, sf_parent_i, dentry, &path);
    732733    if (!err) {
    733734        VBOXSFREMOVEREQ *pReq = (VBOXSFREMOVEREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFREMOVEREQ, StrPath.String)
     
    777778 * @returns 0 on success, Linux error code otherwise
    778779 */
    779 static int sf_unlink(struct inode *parent, struct dentry *dentry)
    780 {
    781     TRACE();
    782     return sf_unlink_aux(parent, dentry, 0 /*fDirectory*/);
     780static int vbsf_inode_unlink(struct inode *parent, struct dentry *dentry)
     781{
     782    TRACE();
     783    return vbsf_unlink_worker(parent, dentry, false /*fDirectory*/);
    783784}
    784785
     
    790791 * @returns 0 on success, Linux error code otherwise
    791792 */
    792 static int sf_rmdir(struct inode *parent, struct dentry *dentry)
    793 {
    794     TRACE();
    795     return sf_unlink_aux(parent, dentry, 1 /*fDirectory*/);
     793static int vbsf_inode_rmdir(struct inode *parent, struct dentry *dentry)
     794{
     795    TRACE();
     796    return vbsf_unlink_worker(parent, dentry, true /*fDirectory*/);
    796797}
    797798
     
    806807 * @returns 0 on success, Linux error code otherwise
    807808 */
    808 static int sf_rename(struct inode *old_parent, struct dentry *old_dentry,
    809                      struct inode *new_parent, struct dentry *new_dentry
     809static int vbsf_inode_rename(struct inode *old_parent, struct dentry *old_dentry,
     810                             struct inode *new_parent, struct dentry *new_dentry
    810811#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
    811                      , unsigned flags
    812 #endif
    813                      )
     812                             , unsigned flags
     813#endif
     814                             )
    814815{
    815816    int err = 0, rc = VINF_SUCCESS;
     
    842843
    843844        old_path = sf_file_i->path;
    844         err = sf_path_from_dentry(__func__, sf_g, sf_new_i,
    845                       new_dentry, &new_path);
     845        err = vbsf_path_from_dentry(__func__, sf_g, sf_new_i, new_dentry, &new_path);
    846846        if (err)
    847847            LogFunc(("failed to create new path\n"));
    848848        else {
    849849            VBOXSFRENAMEWITHSRCBUFREQ *pReq;
    850             pReq = (VBOXSFRENAMEWITHSRCBUFREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFRENAMEWITHSRCBUFREQ,
    851                                                  StrDstPath.String)
    852                                         + new_path->u16Size);
     850            pReq = (VBOXSFRENAMEWITHSRCBUFREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFRENAMEWITHSRCBUFREQ, StrDstPath.String)
     851                                                                    + new_path->u16Size);
    853852            if (pReq) {
    854853                memcpy(&pReq->StrDstPath, new_path, SHFLSTRING_HEADER_SIZE + new_path->u16Size);
    855854                rc = VbglR0SfHostReqRenameWithSrcContig(sf_g->map.root, pReq,
    856                                     old_path, virt_to_phys(old_path),
    857                                     old_dentry->d_inode->i_mode & S_IFDIR ? SHFL_RENAME_DIR
    858                                     : SHFL_RENAME_FILE | SHFL_RENAME_REPLACE_IF_EXISTS);
     855                                                        old_path, virt_to_phys(old_path),
     856                                                        old_dentry->d_inode->i_mode & S_IFDIR ? SHFL_RENAME_DIR
     857                                                        : SHFL_RENAME_FILE | SHFL_RENAME_REPLACE_IF_EXISTS);
    859858                VbglR0PhysHeapFree(pReq);
    860859            } else
     
    867866                /* Set the new relative path in the inode. */
    868867                sf_file_i->path = new_path;
    869 
    870868            } else {
    871869                LogFunc(("VbglR0SfRename failed rc=%Rrc\n",
     
    880878
    881879#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    882 static int sf_symlink(struct inode *parent, struct dentry *dentry, const char *symname)
     880static int vbsf_ino_symlink(struct inode *parent, struct dentry *dentry, const char *symname)
    883881{
    884882    int err;
     
    897895    BUG_ON(!sf_i);
    898896
    899     err = sf_path_from_dentry(__func__, sf_g, sf_i, dentry, &path);
     897    err = vbsf_path_from_dentry(__func__, sf_g, sf_i, dentry, &path);
    900898    if (err)
    901899        goto fail0;
    902900
    903     ssymname =
    904         kmalloc(offsetof(SHFLSTRING, String.utf8) + symname_len,
    905             GFP_KERNEL);
     901    ssymname = kmalloc(offsetof(SHFLSTRING, String.utf8) + symname_len, GFP_KERNEL);
    906902    if (!ssymname) {
    907903        LogRelFunc(("kmalloc failed, caller=sf_symlink\n"));
     
    914910    memcpy(ssymname->String.utf8, symname, symname_len);
    915911
    916     rc = VbglR0SfSymlink(&client_handle, &sf_g->map, path, ssymname, &info);
     912    rc = VbglR0SfSymlink(&g_SfClient, &sf_g->map, path, ssymname, &info);
    917913    kfree(ssymname);
    918914
     
    922918            goto fail1;
    923919        }
    924         LogFunc(("VbglR0SfSymlink(%s) failed rc=%Rrc\n",
    925              sf_i->path->String.utf8, rc));
     920        LogFunc(("VbglR0SfSymlink(%s) failed rc=%Rrc\n", sf_i->path->String.utf8, rc));
    926921        err = -EPROTO;
    927922        goto fail1;
    928923    }
    929924
    930     err = sf_instantiate(parent, dentry, path, &info, SHFL_HANDLE_NIL);
     925    err = vbsf_inode_instantiate(parent, dentry, path, &info, SHFL_HANDLE_NIL);
    931926    if (err) {
    932         LogFunc(("could not instantiate dentry for %s err=%d\n",
    933              sf_i->path->String.utf8, err));
     927        LogFunc(("could not instantiate dentry for %s err=%d\n", sf_i->path->String.utf8, err));
    934928        goto fail1;
    935929    }
     
    945939#endif /* LINUX_VERSION_CODE >= 2.6.0 */
    946940
    947 struct inode_operations sf_dir_iops = {
    948     .lookup = sf_lookup,
    949     .create = sf_create,
    950     .mkdir = sf_mkdir,
    951     .rmdir = sf_rmdir,
    952     .unlink = sf_unlink,
    953     .rename = sf_rename,
     941struct inode_operations vbsf_dir_iops = {
     942    .lookup = vbsf_inode_lookup,
     943    .create = vbsf_inode_create,
     944    .mkdir = vbsf_inode_mkdir,
     945    .rmdir = vbsf_inode_rmdir,
     946    .unlink = vbsf_inode_unlink,
     947    .rename = vbsf_inode_rename,
    954948#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
    955     .revalidate = sf_inode_revalidate
     949    .revalidate = vbsf_inode_revalidate
    956950#else
    957     .getattr = sf_getattr,
    958     .setattr = sf_setattr,
    959     .symlink = sf_symlink
     951    .getattr = vbsf_inode_getattr,
     952    .setattr = vbsf_inode_setattr,
     953    .symlink = vbsf_ino_symlink
    960954#endif
    961955};
  • trunk/src/VBox/Additions/linux/sharedfolders/lnkops.c

    r77526 r77529  
    3434
    3535# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
     36
    3637#  if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
    37 static const char *sf_follow_link(struct dentry *dentry, void **cookie)
    38 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
    39 static void *sf_follow_link(struct dentry *dentry, struct nameidata *nd)
    40 #else
    41 static int sf_follow_link(struct dentry *dentry, struct nameidata *nd)
     38static const char *vbsf_follow_link(struct dentry *dentry, void **cookie)
     39#  elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
     40static void       *vbsf_follow_link(struct dentry *dentry, struct nameidata *nd)
     41#  else
     42static int         vbsf_follow_link(struct dentry *dentry, struct nameidata *nd)
    4243#  endif
    4344{
     
    5152    if (path) {
    5253        error = 0;
    53         rc = VbglR0SfReadLink(&client_handle, &sf_g->map, sf_i->path,
     54        rc = VbglR0SfReadLink(&g_SfClient, &sf_g->map, sf_i->path,
    5455                      PATH_MAX, path);
    5556        if (RT_FAILURE(rc)) {
     
    6364#  else
    6465    nd_set_link(nd, error ? ERR_PTR(error) : path);
    65 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
     66#   if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
    6667    return NULL;
    67 # else
     68#   else
    6869    return 0;
    69 # endif
    70 #endif
     70#   endif
     71#  endif
    7172}
    7273
    7374#  if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
    74 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
    75 static void sf_put_link(struct dentry *dentry, struct nameidata *nd,
    76             void *cookie)
    77 #else
    78 static void sf_put_link(struct dentry *dentry, struct nameidata *nd)
    79 #endif
     75#   if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
     76static void vbsf_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
     77#   else
     78static void vbsf_put_link(struct dentry *dentry, struct nameidata *nd)
     79#   endif
    8080{
    8181    char *page = nd_get_link(nd);
     
    8383        free_page((unsigned long)page);
    8484}
    85 #  endif
     85#  endif /* < 4.2.0 */
    8686
    87 # else  /* LINUX_VERSION_CODE >= 4.5.0 */
    88 static const char *sf_get_link(struct dentry *dentry, struct inode *inode,
    89                               struct delayed_call *done)
     87# else  /* >= 4.5.0 */
     88
     89static const char *vbsf_get_link(struct dentry *dentry, struct inode *inode, struct delayed_call *done)
    9090{
    9191    struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
     
    9999    if (!path)
    100100        return ERR_PTR(-ENOMEM);
    101     rc = VbglR0SfReadLink(&client_handle, &sf_g->map, sf_i->path, PATH_MAX,
    102                   path);
     101    rc = VbglR0SfReadLink(&g_SfClient, &sf_g->map, sf_i->path, PATH_MAX, path);
    103102    if (RT_FAILURE(rc)) {
    104         LogFunc(("VbglR0SfReadLink failed, caller=%s, rc=%Rrc\n",
    105              __func__, rc));
     103        LogFunc(("VbglR0SfReadLink failed, rc=%Rrc\n", rc));
    106104        kfree(path);
    107105        return ERR_PTR(-EPROTO);
     
    110108    return path;
    111109}
    112 # endif /* LINUX_VERSION_CODE >= 4.5.0 */
    113110
    114 struct inode_operations sf_lnk_iops = {
     111# endif /* >= 4.5.0 */
     112
     113struct inode_operations vbsf_lnk_iops = {
    115114# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
    116115    .readlink = generic_readlink,
    117116# endif
    118117# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
    119     .get_link = sf_get_link
     118    .get_link = vbsf_get_link
    120119# elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
    121     .follow_link = sf_follow_link,
     120    .follow_link = vbsf_follow_link,
    122121    .put_link = free_page_put_link,
    123122# else
    124     .follow_link = sf_follow_link,
    125     .put_link = sf_put_link
     123    .follow_link = vbsf_follow_link,
     124    .put_link = vbsf_put_link
    126125# endif
    127126};
  • trunk/src/VBox/Additions/linux/sharedfolders/regops.c

    r77526 r77529  
    5858 * @param   pInodeInfo  The inode which handles to drop.
    5959 */
    60 void sf_handle_drop_chain(struct sf_inode_info *pInodeInfo)
     60void vbsf_handle_drop_chain(struct sf_inode_info *pInodeInfo)
    6161{
    6262    struct sf_handle *pCur, *pNext;
    6363    unsigned long     fSavedFlags;
    64     SFLOGFLOW(("sf_handle_drop_chain: %p\n", pInodeInfo));
     64    SFLOGFLOW(("vbsf_handle_drop_chain: %p\n", pInodeInfo));
    6565    spin_lock_irqsave(&g_SfHandleLock, fSavedFlags);
    6666
     
    7979 * Locates a handle that matches all the flags in @a fFlags.
    8080 *
    81  * @returns Pointer to handle on success (retained), use sf_handle_release() to
     81 * @returns Pointer to handle on success (retained), use vbsf_handle_release() to
    8282 *          release it.  NULL if no suitable handle was found.
    8383 * @param   pInodeInfo  The inode info to search.
     
    8585 * @param   fFlagsClear The flags that must be clear.
    8686 */
    87 struct sf_handle *sf_handle_find(struct sf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear)
     87struct sf_handle *vbsf_handle_find(struct sf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear)
    8888{
    8989    struct sf_handle *pCur;
     
    9898            if (cRefs > 1) {
    9999                spin_unlock_irqrestore(&g_SfHandleLock, fSavedFlags);
    100                 SFLOGFLOW(("sf_handle_find: returns %p\n", pCur));
     100                SFLOGFLOW(("vbsf_handle_find: returns %p\n", pCur));
    101101                return pCur;
    102102            }
     
    107107
    108108    spin_unlock_irqrestore(&g_SfHandleLock, fSavedFlags);
    109     SFLOGFLOW(("sf_handle_find: returns NULL!\n"));
     109    SFLOGFLOW(("vbsf_handle_find: returns NULL!\n"));
    110110    return NULL;
    111111}
     
    113113
    114114/**
    115  * Slow worker for sf_handle_release() that does the freeing.
     115 * Slow worker for vbsf_handle_release() that does the freeing.
    116116 *
    117117 * @returns 0 (ref count).
     
    121121 * @param   pszCaller       The caller name (for logging failures).
    122122 */
    123 uint32_t sf_handle_release_slow(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller)
     123uint32_t vbsf_handle_release_slow(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller)
    124124{
    125125    int rc;
    126126    unsigned long fSavedFlags;
    127127
    128     SFLOGFLOW(("sf_handle_release_slow: %p (%s)\n", pHandle, pszCaller));
     128    SFLOGFLOW(("vbsf_handle_release_slow: %p (%s)\n", pHandle, pszCaller));
    129129
    130130    /*
     
    163163 * @param   pHandle             The handle to add.
    164164 */
    165 void sf_handle_append(struct sf_inode_info *pInodeInfo, struct sf_handle *pHandle)
     165void vbsf_handle_append(struct sf_inode_info *pInodeInfo, struct sf_handle *pHandle)
    166166{
    167167#ifdef VBOX_STRICT
     
    170170    unsigned long fSavedFlags;
    171171
    172     SFLOGFLOW(("sf_handle_append: %p (to %p)\n", pHandle, pInodeInfo));
     172    SFLOGFLOW(("vbsf_handle_append: %p (to %p)\n", pHandle, pInodeInfo));
    173173    AssertMsg((pHandle->fFlags & (SF_HANDLE_F_MAGIC_MASK | SF_HANDLE_F_ON_LIST)) == SF_HANDLE_F_MAGIC,
    174174          ("%p %#x\n", pHandle, pHandle->fFlags));
     
    198198 && LINUX_VERSION_CODE <  KERNEL_VERSION(2, 6, 31)
    199199
    200 void free_pipebuf(struct page *kpage)
     200/*
     201 * Some pipe stuff we apparently need for 2.6.23-2.6.30.
     202 */
     203
     204static void vbsf_free_pipebuf(struct page *kpage)
    201205{
    202206    kunmap(kpage);
     
    204208}
    205209
    206 void *sf_pipe_buf_map(struct pipe_inode_info *pipe,
    207               struct pipe_buffer *pipe_buf, int atomic)
     210static void *vbsf_pipe_buf_map(struct pipe_inode_info *pipe, struct pipe_buffer *pipe_buf, int atomic)
    208211{
    209212    return 0;
    210213}
    211214
    212 void sf_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *pipe_buf)
    213 {
    214 }
    215 
    216 void sf_pipe_buf_unmap(struct pipe_inode_info *pipe,
    217                struct pipe_buffer *pipe_buf, void *map_data)
    218 {
    219 }
    220 
    221 int sf_pipe_buf_steal(struct pipe_inode_info *pipe,
    222               struct pipe_buffer *pipe_buf)
     215static void vbsf_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *pipe_buf)
     216{
     217}
     218
     219static void vbsf_pipe_buf_unmap(struct pipe_inode_info *pipe, struct pipe_buffer *pipe_buf, void *map_data)
     220{
     221}
     222
     223static int vbsf_pipe_buf_steal(struct pipe_inode_info *pipe, struct pipe_buffer *pipe_buf)
    223224{
    224225    return 0;
    225226}
    226227
    227 static void sf_pipe_buf_release(struct pipe_inode_info *pipe,
    228                 struct pipe_buffer *pipe_buf)
    229 {
    230     free_pipebuf(pipe_buf->page);
    231 }
    232 
    233 int sf_pipe_buf_confirm(struct pipe_inode_info *info,
    234             struct pipe_buffer *pipe_buf)
     228static void vbsf_pipe_buf_release(struct pipe_inode_info *pipe, struct pipe_buffer *pipe_buf)
     229{
     230    vbsf_free_pipebuf(pipe_buf->page);
     231}
     232
     233static int vbsf_pipe_buf_confirm(struct pipe_inode_info *info, struct pipe_buffer *pipe_buf)
    235234{
    236235    return 0;
    237236}
    238237
    239 static struct pipe_buf_operations sf_pipe_buf_ops = {
     238static struct pipe_buf_operations vbsf_pipe_buf_ops = {
    240239    .can_merge = 0,
    241     .map = sf_pipe_buf_map,
    242     .unmap = sf_pipe_buf_unmap,
    243     .confirm = sf_pipe_buf_confirm,
    244     .release = sf_pipe_buf_release,
    245     .steal = sf_pipe_buf_steal,
    246     .get = sf_pipe_buf_get,
     240    .map = vbsf_pipe_buf_map,
     241    .unmap = vbsf_pipe_buf_unmap,
     242    .confirm = vbsf_pipe_buf_confirm,
     243    .release = vbsf_pipe_buf_release,
     244    .steal = vbsf_pipe_buf_steal,
     245    .get = vbsf_pipe_buf_get,
    247246};
    248247
    249 static int sf_reg_read_aux(const char *caller, struct vbsf_super_info *sf_g,
    250                struct sf_reg_info *sf_r, void *buf,
    251                uint32_t * nread, uint64_t pos)
    252 {
    253     int rc = VbglR0SfRead(&client_handle, &sf_g->map, sf_r->Handle.hHost,
    254                   pos, nread, buf, false /* already locked? */ );
     248static int vbsf_reg_read_aux(const char *caller, struct vbsf_super_info *sf_g, struct sf_reg_info *sf_r,
     249                             void *buf, uint32_t *nread, uint64_t pos)
     250{
     251    int rc = VbglR0SfRead(&g_SfClient, &sf_g->map, sf_r->Handle.hHost, pos, nread, buf, false /* already locked? */ );
    255252    if (RT_FAILURE(rc)) {
    256253        LogFunc(("VbglR0SfRead failed. caller=%s, rc=%Rrc\n", caller,
     
    264261# define UNLOCK_PIPE(pipe) do { if (pipe->inode) mutex_unlock(&pipe->inode->i_mutex); } while (0)
    265262
    266 ssize_t
    267 sf_splice_read(struct file *in, loff_t * poffset,
    268            struct pipe_inode_info *pipe, size_t len, unsigned int flags)
     263ssize_t vbsf_splice_read(struct file *in, loff_t * poffset, struct pipe_inode_info *pipe, size_t len, unsigned int flags)
    269264{
    270265    size_t bytes_remaining = len;
     
    298293        }
    299294        req_size = 0;
    300         uint32_t nread = req_size =
    301             (uint32_t) min(bytes_remaining, (size_t) PAGE_SIZE);
     295        uint32_t nread = req_size = (uint32_t) min(bytes_remaining, (size_t) PAGE_SIZE);
    302296        uint32_t chunk = 0;
    303297        void *kbuf = kmap(kpage);
    304298        while (chunk < req_size) {
    305             retval =
    306                 sf_reg_read_aux(__func__, sf_g, sf_r, kbuf + chunk,
    307                         &nread, offset);
     299            retval = vbsf_reg_read_aux(__func__, sf_g, sf_r, kbuf + chunk, &nread, offset);
    308300            if (retval < 0)
    309301                goto err;
     
    320312        }
    321313        if (pipe->nrbufs < PIPE_BUFFERS) {
    322             struct pipe_buffer *pipebuf =
    323                 pipe->bufs +
    324                 ((pipe->curbuf + pipe->nrbufs) & (PIPE_BUFFERS -
    325                                   1));
     314            struct pipe_buffer *pipebuf = pipe->bufs + ((pipe->curbuf + pipe->nrbufs) & (PIPE_BUFFERS - 1));
    326315            pipebuf->page = kpage;
    327             pipebuf->ops = &sf_pipe_buf_ops;
     316            pipebuf->ops = &vbsf_pipe_buf_ops;
    328317            pipebuf->len = req_size;
    329318            pipebuf->offset = 0;
     
    341330                goto err;
    342331            }
    343             free_pipebuf(kpage);
     332            vbsf_free_pipebuf(kpage);
    344333            break;
    345334        }
     
    353342 err:
    354343    UNLOCK_PIPE(pipe);
    355     free_pipebuf(kpage);
     344    vbsf_free_pipebuf(kpage);
    356345    return retval;
    357346}
     
    360349
    361350
    362 /** Companion to sf_lock_user_pages(). */
    363 DECLINLINE(void) sf_unlock_user_pages(struct page **papPages, size_t cPages, bool fSetDirty)
     351/** Companion to vbsf_lock_user_pages(). */
     352DECLINLINE(void) vbsf_unlock_user_pages(struct page **papPages, size_t cPages, bool fSetDirty)
    364353{
    365354    while (cPages-- > 0)
     
    378367
    379368/** Wrapper around get_user_pages. */
    380 DECLINLINE(int) sf_lock_user_pages(uintptr_t uPtrFrom, size_t cPages, bool fWrite, struct page **papPages)
     369DECLINLINE(int) vbsf_lock_user_pages(uintptr_t uPtrFrom, size_t cPages, bool fWrite, struct page **papPages)
    381370{
    382371# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
     
    400389        return cPagesLocked;
    401390
    402     sf_unlock_user_pages(papPages, cPagesLocked, false /*fSetDirty*/);
     391    vbsf_unlock_user_pages(papPages, cPagesLocked, false /*fSetDirty*/);
    403392
    404393    /* We could use uPtrFrom + cPagesLocked to get the correct status here... */
     
    413402 * the file content.
    414403 */
    415 static ssize_t sf_reg_read_mapped(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off)
     404static ssize_t vbsf_reg_read_mapped(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off)
    416405{
    417406#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     
    452441
    453442/**
    454  * Fallback case of sf_reg_read() that locks the user buffers and let the host
     443 * Fallback case of vbsf_reg_read() that locks the user buffers and let the host
    455444 * write directly to them.
    456445 */
    457 static ssize_t sf_reg_read_fallback(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off,
    458                                     struct vbsf_super_info *sf_g, struct sf_reg_info *sf_r)
     446static ssize_t vbsf_reg_read_fallback(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off,
     447                                      struct vbsf_super_info *sf_g, struct sf_reg_info *sf_r)
    459448{
    460449    /*
     
    497486            }
    498487
    499             rc = sf_lock_user_pages((uintptr_t)buf, cPages, true /*fWrite*/, papPages);
     488            rc = vbsf_lock_user_pages((uintptr_t)buf, cPages, true /*fWrite*/, papPages);
    500489            if (rc == 0) {
    501490                size_t iPage = cPages;
     
    512501            rc = VbglR0SfHostReqReadPgLst(sf_g->map.root, pReq, sf_r->Handle.hHost, offFile, cbChunk, cPages);
    513502
    514             sf_unlock_user_pages(papPages, cPages, true /*fSetDirty*/);
     503            vbsf_unlock_user_pages(papPages, cPages, true /*fSetDirty*/);
    515504
    516505            if (RT_SUCCESS(rc)) {
     
    569558 * @returns the number of read bytes on success, Linux error code otherwise
    570559 */
    571 static ssize_t sf_reg_read(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off)
     560static ssize_t vbsf_reg_read(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off)
    572561{
    573562    struct inode *inode = GET_F_DENTRY(file)->d_inode;
     
    576565    struct address_space *mapping = inode->i_mapping;
    577566
    578     SFLOGFLOW(("sf_reg_read: inode=%p file=%p buf=%p size=%#zx off=%#llx\n", inode, file, buf, size, *off));
     567    SFLOGFLOW(("vbsf_reg_read: inode=%p file=%p buf=%p size=%#zx off=%#llx\n", inode, file, buf, size, *off));
    579568
    580569    if (!S_ISREG(inode->i_mode)) {
     
    599588        && !(file->f_flags & O_DIRECT)
    600589        && 1 /** @todo make this behaviour configurable */ )
    601         return sf_reg_read_mapped(file, buf, size, off);
     590        return vbsf_reg_read_mapped(file, buf, size, off);
    602591
    603592    /*
     
    658647#endif
    659648
    660     return sf_reg_read_fallback(file, buf, size, off, sf_g, sf_r);
     649    return vbsf_reg_read_fallback(file, buf, size, off, sf_g, sf_r);
    661650}
    662651
     
    664653/**
    665654 * Wrapper around invalidate_mapping_pages() for page cache invalidation so that
    666  * the changes written via sf_reg_write are made visible to mmap users.
    667  */
    668 DECLINLINE(void) sf_reg_write_invalidate_mapping_range(struct address_space *mapping, loff_t offStart, loff_t offEnd)
     655 * the changes written via vbsf_reg_write are made visible to mmap users.
     656 */
     657DECLINLINE(void) vbsf_reg_write_invalidate_mapping_range(struct address_space *mapping, loff_t offStart, loff_t offEnd)
    669658{
    670659    /*
     
    691680
    692681/**
    693  * Fallback case of sf_reg_write() that locks the user buffers and let the host
     682 * Fallback case of vbsf_reg_write() that locks the user buffers and let the host
    694683 * write directly to them.
    695684 */
    696 static ssize_t sf_reg_write_fallback(struct file *file, const char /*__user*/ *buf, size_t size, loff_t *off, loff_t offFile,
    697                                      struct inode *inode, struct sf_inode_info *sf_i,
    698                                      struct vbsf_super_info *sf_g, struct sf_reg_info *sf_r)
     685static ssize_t vbsf_reg_write_fallback(struct file *file, const char /*__user*/ *buf, size_t size, loff_t *off, loff_t offFile,
     686                                       struct inode *inode, struct sf_inode_info *sf_i,
     687                                       struct vbsf_super_info *sf_g, struct sf_reg_info *sf_r)
    699688{
    700689    /*
     
    736725            }
    737726
    738             rc = sf_lock_user_pages((uintptr_t)buf, cPages, false /*fWrite*/, papPages);
     727            rc = vbsf_lock_user_pages((uintptr_t)buf, cPages, false /*fWrite*/, papPages);
    739728            if (rc == 0) {
    740729                size_t iPage = cPages;
     
    751740            rc = VbglR0SfHostReqWritePgLst(sf_g->map.root, pReq, sf_r->Handle.hHost, offFile, cbChunk, cPages);
    752741
    753             sf_unlock_user_pages(papPages, cPages, false /*fSetDirty*/);
     742            vbsf_unlock_user_pages(papPages, cPages, false /*fSetDirty*/);
    754743
    755744            if (RT_SUCCESS(rc)) {
     
    765754                if (offFile > i_size_read(inode))
    766755                    i_size_write(inode, offFile);
    767                 sf_reg_write_invalidate_mapping_range(inode->i_mapping, offFile - cbActual, offFile);
     756                vbsf_reg_write_invalidate_mapping_range(inode->i_mapping, offFile - cbActual, offFile);
    768757
    769758                /*
     
    812801 * @returns the number of written bytes on success, Linux error code otherwise
    813802 */
    814 static ssize_t sf_reg_write(struct file *file, const char *buf, size_t size,
    815                 loff_t * off)
     803static ssize_t vbsf_reg_write(struct file *file, const char *buf, size_t size, loff_t * off)
    816804{
    817805    struct inode           *inode   = GET_F_DENTRY(file)->d_inode;
     
    822810    loff_t                  pos;
    823811
    824     SFLOGFLOW(("sf_reg_write: inode=%p file=%p buf=%p size=%#zx off=%#llx\n", inode, file, buf, size, *off));
     812    SFLOGFLOW(("vbsf_reg_write: inode=%p file=%p buf=%p size=%#zx off=%#llx\n", inode, file, buf, size, *off));
    825813    BUG_ON(!sf_i);
    826814    BUG_ON(!sf_g);
     
    882870                    if (pos > i_size_read(inode))
    883871                        i_size_write(inode, pos);
    884                     sf_reg_write_invalidate_mapping_range(mapping, pos - cbRet, pos);
     872                    vbsf_reg_write_invalidate_mapping_range(mapping, pos - cbRet, pos);
    885873                } else
    886874                    cbRet = -EPROTO;
     
    916904                        if (pos > i_size_read(inode))
    917905                            i_size_write(inode, pos);
    918                         sf_reg_write_invalidate_mapping_range(mapping, pos - cbRet, pos);
     906                        vbsf_reg_write_invalidate_mapping_range(mapping, pos - cbRet, pos);
    919907                    } else
    920908                        cbRet = -EPROTO;
     
    933921#endif
    934922
    935     return sf_reg_write_fallback(file, buf, size, off, pos, inode, sf_i, sf_g, sf_r);
     923    return vbsf_reg_write_fallback(file, buf, size, off, pos, inode, sf_i, sf_g, sf_r);
    936924}
    937925
     
    944932 * @returns 0 on success, Linux error code otherwise
    945933 */
    946 static int sf_reg_open(struct inode *inode, struct file *file)
     934static int vbsf_reg_open(struct inode *inode, struct file *file)
    947935{
    948936    int rc, rc_linux = 0;
     
    960948    SHFLCREATEPARMS *pCreateParms;  /* temp glue */
    961949
    962     SFLOGFLOW(("sf_reg_open: inode=%p file=%p flags=%#x %s\n",
     950    SFLOGFLOW(("vbsf_reg_open: inode=%p file=%p flags=%#x %s\n",
    963951           inode, file, file->f_flags, sf_i ? sf_i->path->String.ach : NULL));
    964952    BUG_ON(!sf_g);
     
    979967    if (sf_i->handle != SHFL_HANDLE_NIL) {
    980968        /*
    981          * This inode was created with sf_create_aux(). Check the CreateFlags:
     969         * This inode was created with vbsf_create_worker(). Check the CreateFlags:
    982970         * O_CREAT, O_TRUNC: inherent true (file was just created). Not sure
    983971         * about the access flags (SHFL_CF_ACCESS_*).
     
    989977
    990978        sf_r->Handle.fFlags |= SF_HANDLE_F_READ | SF_HANDLE_F_WRITE; /** @todo check */
    991         sf_handle_append(sf_i, &sf_r->Handle);
    992         SFLOGFLOW(("sf_reg_open: returns 0 (#1) - sf_i=%p hHost=%#llx\n", sf_i, sf_r->Handle.hHost));
     979        vbsf_handle_append(sf_i, &sf_r->Handle);
     980        SFLOGFLOW(("vbsf_reg_open: returns 0 (#1) - sf_i=%p hHost=%#llx\n", sf_i, sf_r->Handle.hHost));
    993981        return 0;
    994982    }
     
    10571045
    10581046    pCreateParms->Info.Attr.fMode = inode->i_mode;
    1059     LogFunc(("sf_reg_open: calling VbglR0SfHostReqCreate, file %s, flags=%#x, %#x\n", sf_i->path->String.utf8, file->f_flags, pCreateParms->CreateFlags));
     1047    LogFunc(("vbsf_reg_open: calling VbglR0SfHostReqCreate, file %s, flags=%#x, %#x\n", sf_i->path->String.utf8, file->f_flags, pCreateParms->CreateFlags));
    10601048    rc = VbglR0SfHostReqCreate(sf_g->map.root, pReq);
    10611049    if (RT_FAILURE(rc)) {
     
    10671055
    10681056    if (pCreateParms->Handle != SHFL_HANDLE_NIL) {
    1069         sf_dentry_chain_increase_ttl(dentry);
     1057        vbsf_dentry_chain_increase_ttl(dentry);
    10701058        rc_linux = 0;
    10711059    } else {
     
    10791067            break;
    10801068        case SHFL_FILE_EXISTS:
    1081             sf_dentry_chain_increase_ttl(dentry);
     1069            vbsf_dentry_chain_increase_ttl(dentry);
    10821070            rc_linux = -EEXIST;
    10831071            break;
    10841072        default:
    1085             sf_dentry_chain_increase_parent_ttl(dentry);
     1073            vbsf_dentry_chain_increase_parent_ttl(dentry);
    10861074            rc_linux = 0;
    10871075            break;
     
    10921080    sf_r->Handle.hHost = pCreateParms->Handle;
    10931081    file->private_data = sf_r;
    1094     sf_handle_append(sf_i, &sf_r->Handle);
     1082    vbsf_handle_append(sf_i, &sf_r->Handle);
    10951083    VbglR0PhysHeapFree(pReq);
    1096     SFLOGFLOW(("sf_reg_open: returns 0 (#2) - sf_i=%p hHost=%#llx\n", sf_i, sf_r->Handle.hHost));
     1084    SFLOGFLOW(("vbsf_reg_open: returns 0 (#2) - sf_i=%p hHost=%#llx\n", sf_i, sf_r->Handle.hHost));
    10971085    return rc_linux;
    10981086}
     
    11061094 * @returns 0 on success, Linux error code otherwise
    11071095 */
    1108 static int sf_reg_release(struct inode *inode, struct file *file)
     1096static int vbsf_reg_release(struct inode *inode, struct file *file)
    11091097{
    11101098    struct sf_reg_info *sf_r;
     
    11121100    struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
    11131101
    1114     SFLOGFLOW(("sf_reg_release: inode=%p file=%p\n", inode, file));
     1102    SFLOGFLOW(("vbsf_reg_release: inode=%p file=%p\n", inode, file));
    11151103    sf_g = VBSF_GET_SUPER_INFO(inode->i_sb);
    11161104    sf_r = file->private_data;
     
    11321120    /* Release sf_r, closing the handle if we're the last user. */
    11331121    file->private_data = NULL;
    1134     sf_handle_release(&sf_r->Handle, sf_g, "sf_reg_release");
     1122    vbsf_handle_release(&sf_r->Handle, sf_g, "vbsf_reg_release");
    11351123
    11361124    sf_i->handle = SHFL_HANDLE_NIL;
     
    11471135 * relative seeks.
    11481136 */
    1149 static loff_t sf_reg_llseek(struct file *file, loff_t off, int whence)
    1150 {
    1151     SFLOGFLOW(("sf_reg_llseek: file=%p off=%lld whence=%d\n", file, off, whence));
     1137static loff_t vbsf_reg_llseek(struct file *file, loff_t off, int whence)
     1138{
     1139    SFLOGFLOW(("vbsf_reg_llseek: file=%p off=%lld whence=%d\n", file, off, whence));
    11521140
    11531141    switch (whence) {
     
    11581146        case SEEK_END: {
    11591147            struct sf_reg_info *sf_r = file->private_data;
    1160             int rc = sf_inode_revalidate_with_handle(GET_F_DENTRY(file), sf_r->Handle.hHost, true /*fForce*/,
     1148            int rc = vbsf_inode_revalidate_with_handle(GET_F_DENTRY(file), sf_r->Handle.hHost, true /*fForce*/,
    11611149                                 false /*fInodeLocked*/);
    11621150            if (rc == 0)
     
    11821170 */
    11831171#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
    1184 static int sf_reg_fsync(struct file *file, loff_t start, loff_t end, int datasync)
     1172static int vbsf_reg_fsync(struct file *file, loff_t start, loff_t end, int datasync)
    11851173{
    11861174# if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     
    11911179}
    11921180#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
    1193 static int sf_reg_fsync(struct file *file, int datasync)
     1181static int vbsf_reg_fsync(struct file *file, int datasync)
    11941182{
    11951183    return generic_file_fsync(file, datasync);
    11961184}
    11971185#else /* < 2.6.35 */
    1198 static int sf_reg_fsync(struct file *file, struct dentry *dentry, int datasync)
     1186static int vbsf_reg_fsync(struct file *file, struct dentry *dentry, int datasync)
    11991187{
    12001188# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
     
    12321220
    12331221
    1234 struct file_operations sf_reg_fops = {
    1235     .read = sf_reg_read,
    1236     .open = sf_reg_open,
    1237     .write = sf_reg_write,
    1238     .release = sf_reg_release,
     1222/**
     1223 * File operations for regular files.
     1224 */
     1225struct file_operations vbsf_reg_fops = {
     1226    .read = vbsf_reg_read,
     1227    .open = vbsf_reg_open,
     1228    .write = vbsf_reg_write,
     1229    .release = vbsf_reg_release,
    12391230    .mmap = generic_file_mmap,
    12401231#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
     
    12431234 * cached.  Investigate. */
    12441235# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
    1245     .splice_read = sf_splice_read,
     1236    .splice_read = vbsf_splice_read,
    12461237# else
    12471238    .sendfile = generic_file_sendfile,
     
    12511242# endif
    12521243#endif
    1253     .llseek = sf_reg_llseek,
    1254     .fsync = sf_reg_fsync,
     1244    .llseek = vbsf_reg_llseek,
     1245    .fsync = vbsf_reg_fsync,
    12551246};
    12561247
    1257 struct inode_operations sf_reg_iops = {
     1248struct inode_operations vbsf_reg_iops = {
    12581249#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
    1259     .revalidate = sf_inode_revalidate
     1250    .revalidate = vbsf_inode_revalidate
    12601251#else
    1261     .getattr = sf_getattr,
    1262     .setattr = sf_setattr
     1252    .getattr = vbsf_inode_getattr,
     1253    .setattr = vbsf_inode_setattr
    12631254#endif
    12641255};
     1256
    12651257
    12661258#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
     
    12721264 * shared+writeable fashion.
    12731265 */
    1274 static int sf_readpage(struct file *file, struct page *page)
     1266static int vbsf_readpage(struct file *file, struct page *page)
    12751267{
    12761268    struct inode *inode = GET_F_DENTRY(file)->d_inode;
    12771269    int           err;
    12781270
    1279     SFLOGFLOW(("sf_readpage: inode=%p file=%p page=%p off=%#llx\n", inode, file, page, (uint64_t)page->index << PAGE_SHIFT));
     1271    SFLOGFLOW(("vbsf_readpage: inode=%p file=%p page=%p off=%#llx\n", inode, file, page, (uint64_t)page->index << PAGE_SHIFT));
    12801272
    12811273    if (!is_bad_inode(inode)) {
     
    13301322 * fashion.
    13311323 */
    1332 static int sf_writepage(struct page *page, struct writeback_control *wbc)
     1324static int vbsf_writepage(struct page *page, struct writeback_control *wbc)
    13331325{
    13341326    struct address_space *mapping   = page->mapping;
    13351327    struct inode         *inode     = mapping->host;
    13361328    struct sf_inode_info *sf_i      = GET_INODE_INFO(inode);
    1337     struct sf_handle     *pHandle   = sf_handle_find(sf_i, SF_HANDLE_F_WRITE, SF_HANDLE_F_APPEND);
     1329    struct sf_handle     *pHandle   = vbsf_handle_find(sf_i, SF_HANDLE_F_WRITE, SF_HANDLE_F_APPEND);
    13381330    int                   err;
    13391331
    1340     SFLOGFLOW(("sf_writepage: inode=%p page=%p off=%#llx pHandle=%p (%#llx)\n",
     1332    SFLOGFLOW(("vbsf_writepage: inode=%p page=%p off=%#llx pHandle=%p (%#llx)\n",
    13411333           inode, page,(uint64_t)page->index << PAGE_SHIFT, pHandle, pHandle->hHost));
    13421334
     
    13821374        } else
    13831375            err = -ENOMEM;
    1384         sf_handle_release(pHandle, sf_g, "sf_writepage");
     1376        vbsf_handle_release(pHandle, sf_g, "vbsf_writepage");
    13851377    } else {
    13861378        static uint64_t volatile s_cCalls = 0;
    13871379        if (s_cCalls++ < 16)
    1388             printk("sf_writepage: no writable handle for %s..\n", sf_i->path->String.ach);
     1380            printk("vbsf_writepage: no writable handle for %s..\n", sf_i->path->String.ach);
    13891381        err = -EPROTO;
    13901382    }
     
    13971389 * Called when writing thru the page cache (which we shouldn't be doing).
    13981390 */
    1399 int sf_write_begin(struct file *file, struct address_space *mapping, loff_t pos,
    1400            unsigned len, unsigned flags, struct page **pagep,
    1401            void **fsdata)
     1391int vbsf_write_begin(struct file *file, struct address_space *mapping, loff_t pos,
     1392                     unsigned len, unsigned flags, struct page **pagep, void **fsdata)
    14021393{
    14031394    /** @todo r=bird: We shouldn't ever get here, should we?  Because we don't use
     
    14071398    static uint64_t volatile s_cCalls = 0;
    14081399    if (s_cCalls++ < 16) {
    1409         printk("vboxsf: Unexpected call to sf_write_begin(pos=%#llx len=%#x flags=%#x)! Please report.\n",
     1400        printk("vboxsf: Unexpected call to vbsf_write_begin(pos=%#llx len=%#x flags=%#x)! Please report.\n",
    14101401               (unsigned long long)pos, len, flags);
    1411         RTLogBackdoorPrintf("vboxsf: Unexpected call to sf_write_begin(pos=%#llx len=%#x flags=%#x)!  Please report.\n",
     1402        RTLogBackdoorPrintf("vboxsf: Unexpected call to vbsf_write_begin(pos=%#llx len=%#x flags=%#x)!  Please report.\n",
    14121403                    (unsigned long long)pos, len, flags);
    14131404#  ifdef WARN_ON
     
    14251416 */
    14261417#  if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
    1427 static ssize_t sf_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
     1418static ssize_t vbsf_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
    14281419#  elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
    1429 static ssize_t sf_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
     1420static ssize_t vbsf_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
    14301421#  elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
    1431 static ssize_t sf_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
     1422static ssize_t vbsf_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
    14321423#  elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 6)
    1433 static ssize_t sf_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs)
     1424static ssize_t vbsf_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs)
    14341425#  elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 55)
    1435 static int sf_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs)
     1426static int vbsf_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs)
    14361427#  elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41)
    1437 static int sf_direct_IO(int rw, struct file *file, const struct iovec *iov, loff_t offset, unsigned long nr_segs)
     1428static int vbsf_direct_IO(int rw, struct file *file, const struct iovec *iov, loff_t offset, unsigned long nr_segs)
    14381429#  elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 35)
    1439 static int sf_direct_IO(int rw, struct inode *inode, const struct iovec *iov, loff_t offset, unsigned long nr_segs)
     1430static int vbsf_direct_IO(int rw, struct inode *inode, const struct iovec *iov, loff_t offset, unsigned long nr_segs)
    14401431#  elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 26)
    1441 static int sf_direct_IO(int rw, struct inode *inode, char *buf, loff_t offset, size_t count)
     1432static int vbsf_direct_IO(int rw, struct inode *inode, char *buf, loff_t offset, size_t count)
    14421433#  else
    1443 static int sf_direct_IO(int rw, struct inode *inode, struct kiobuf *, unsigned long, int)
     1434static int vbsf_direct_IO(int rw, struct inode *inode, struct kiobuf *, unsigned long, int)
    14441435#  endif
    14451436{
     
    14491440# endif
    14501441
    1451 struct address_space_operations sf_reg_aops = {
    1452     .readpage = sf_readpage,
    1453     .writepage = sf_writepage,
     1442/**
     1443 * Address space (for the page cache) operations for regular files.
     1444 */
     1445struct address_space_operations vbsf_reg_aops = {
     1446    .readpage = vbsf_readpage,
     1447    .writepage = vbsf_writepage,
    14541448    /** @todo Need .writepages if we want msync performance...  */
    14551449# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 12)
     
    14571451# endif
    14581452# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
    1459     .write_begin = sf_write_begin,
     1453    .write_begin = vbsf_write_begin,
    14601454    .write_end = simple_write_end,
    14611455# else
     
    14641458# endif
    14651459# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 10)
    1466     .direct_IO = sf_direct_IO,
     1460    .direct_IO = vbsf_direct_IO,
    14671461# endif
    14681462};
  • trunk/src/VBox/Additions/linux/sharedfolders/utils.c

    r77526 r77529  
    4141 */
    4242#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
    43 DECLINLINE(void) sf_ftime_from_timespec(time_t *pLinuxDst, PCRTTIMESPEC pVBoxSrc)
     43DECLINLINE(void) vbsf_time_to_linux(time_t *pLinuxDst, PCRTTIMESPEC pVBoxSrc)
    4444{
    4545    int64_t t = RTTimeSpecGetNano(pVBoxSrc);
     
    4949#else   /* >= 2.6.0 */
    5050# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
    51 DECLINLINE(void) sf_ftime_from_timespec(struct timespec *pLinuxDst, PCRTTIMESPEC pVBoxSrc)
     51DECLINLINE(void) vbsf_time_to_linux(struct timespec *pLinuxDst, PCRTTIMESPEC pVBoxSrc)
    5252# else
    53 DECLINLINE(void) sf_ftime_from_timespec(struct timespec64 *pLinuxDst, PCRTTIMESPEC pVBoxSrc)
     53DECLINLINE(void) vbsf_time_to_linux(struct timespec64 *pLinuxDst, PCRTTIMESPEC pVBoxSrc)
    5454# endif
    5555{
     
    6565 */
    6666#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
    67 DECLINLINE(void) sf_timespec_from_ftime(PRTTIMESPEC pVBoxDst, time_t *pLinuxSrc)
     67DECLINLINE(void) vbsf_time_to_vbox(PRTTIMESPEC pVBoxDst, time_t *pLinuxSrc)
    6868{
    6969    RTTimeSpecSetNano(pVBoxDst, RT_NS_1SEC_64 * *pLinuxSrc);
     
    7171#else   /* >= 2.6.0 */
    7272# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
    73 DECLINLINE(void) sf_timespec_from_ftime(PRTTIMESPEC pVBoxDst, struct timespec const *pLinuxSrc)
     73DECLINLINE(void) vbsf_time_to_vbox(PRTTIMESPEC pVBoxDst, struct timespec const *pLinuxSrc)
    7474# else
    75 DECLINLINE(void) sf_timespec_from_ftime(PRTTIMESPEC pVBoxDst, struct timespec64 const *pLinuxSrc)
     75DECLINLINE(void) vbsf_time_to_vbox(PRTTIMESPEC pVBoxDst, struct timespec64 const *pLinuxSrc)
    7676# endif
    7777{
     
    8282
    8383/**
    84  * Converts VBox access permissions  to Linux ones (mode & 0777).
     84 * Converts Linux access permissions to VBox ones (mode & 0777).
    8585 *
    8686 * @note Currently identical.
    8787 */
    88 DECLINLINE(int) sf_convert_access_perms(uint32_t fAttr)
     88DECLINLINE(uint32_t) sf_access_permissions_to_vbox(int fAttr)
    8989{
    9090    /* Access bits should be the same: */
     
    104104
    105105/**
     106 * Converts VBox access permissions  to Linux ones (mode & 0777).
     107 *
     108 * @note Currently identical.
     109 */
     110DECLINLINE(int) sf_access_permissions_to_linux(uint32_t fAttr)
     111{
     112    /* Access bits should be the same: */
     113    AssertCompile(RTFS_UNIX_IRUSR == S_IRUSR);
     114    AssertCompile(RTFS_UNIX_IWUSR == S_IWUSR);
     115    AssertCompile(RTFS_UNIX_IXUSR == S_IXUSR);
     116    AssertCompile(RTFS_UNIX_IRGRP == S_IRGRP);
     117    AssertCompile(RTFS_UNIX_IWGRP == S_IWGRP);
     118    AssertCompile(RTFS_UNIX_IXGRP == S_IXGRP);
     119    AssertCompile(RTFS_UNIX_IROTH == S_IROTH);
     120    AssertCompile(RTFS_UNIX_IWOTH == S_IWOTH);
     121    AssertCompile(RTFS_UNIX_IXOTH == S_IXOTH);
     122
     123    return fAttr & RTFS_UNIX_ALL_ACCESS_PERMS;
     124}
     125
     126
     127/**
    106128 * Produce the Linux mode mask, given VBox, mount options and file type.
    107129 */
    108 DECLINLINE(int) sf_convert_file_mode(uint32_t fVBoxMode, int fFixedMode, int fClearMask, int fType)
    109 {
    110     int fLnxMode = sf_convert_access_perms(fVBoxMode);
     130DECLINLINE(int) sf_file_mode_to_linux(uint32_t fVBoxMode, int fFixedMode, int fClearMask, int fType)
     131{
     132    int fLnxMode = sf_access_permissions_to_linux(fVBoxMode);
    111133    if (fFixedMode != ~0)
    112134        fLnxMode = fFixedMode & 0777;
     
    120142 * Initializes the @a inode attributes based on @a pObjInfo and @a sf_g options.
    121143 */
    122 void sf_init_inode(struct inode *inode, struct sf_inode_info *sf_i, PSHFLFSOBJINFO pObjInfo, struct vbsf_super_info *sf_g)
     144void vbsf_init_inode(struct inode *inode, struct sf_inode_info *sf_i, PSHFLFSOBJINFO pObjInfo, struct vbsf_super_info *sf_g)
    123145{
    124146    PCSHFLFSOBJATTR pAttr = &pObjInfo->Attr;
     
    130152
    131153#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    132     inode->i_mapping->a_ops = &sf_reg_aops;
     154    inode->i_mapping->a_ops = &vbsf_reg_aops;
    133155# if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 19, 0)
    134156    inode->i_mapping->backing_dev_info = &sf_g->bdi; /* This is needed for mmap. */
     
    136158#endif
    137159    if (RTFS_IS_DIRECTORY(pAttr->fMode)) {
    138         inode->i_mode = sf_convert_file_mode(pAttr->fMode, sf_g->dmode, sf_g->dmask, S_IFDIR);
    139         inode->i_op = &sf_dir_iops;
    140         inode->i_fop = &sf_dir_fops;
     160        inode->i_mode = sf_file_mode_to_linux(pAttr->fMode, sf_g->dmode, sf_g->dmask, S_IFDIR);
     161        inode->i_op = &vbsf_dir_iops;
     162        inode->i_fop = &vbsf_dir_fops;
    141163
    142164        /* XXX: this probably should be set to the number of entries
     
    148170        /** @todo r=bird: Aren't System V symlinks w/o any mode mask? IIRC there is
    149171         *        no lchmod on Linux. */
    150         inode->i_mode = sf_convert_file_mode(pAttr->fMode, sf_g->fmode, sf_g->fmask, S_IFLNK);
    151         inode->i_op = &sf_lnk_iops;
     172        inode->i_mode = sf_file_mode_to_linux(pAttr->fMode, sf_g->fmode, sf_g->fmask, S_IFLNK);
     173        inode->i_op = &vbsf_lnk_iops;
    152174        set_nlink(inode, 1);
    153175    }
    154176#endif
    155177    else {
    156         inode->i_mode = sf_convert_file_mode(pAttr->fMode, sf_g->fmode, sf_g->fmask, S_IFREG);
    157         inode->i_op = &sf_reg_iops;
    158         inode->i_fop = &sf_reg_fops;
     178        inode->i_mode = sf_file_mode_to_linux(pAttr->fMode, sf_g->fmode, sf_g->fmask, S_IFREG);
     179        inode->i_op = &vbsf_reg_iops;
     180        inode->i_fop = &vbsf_reg_fops;
    159181        set_nlink(inode, 1);
    160182    }
     
    178200    inode->i_blocks = (pObjInfo->cbAllocated + 511) / 512;
    179201
    180     sf_ftime_from_timespec(&inode->i_atime, &pObjInfo->AccessTime);
    181     sf_ftime_from_timespec(&inode->i_ctime, &pObjInfo->ChangeTime);
    182     sf_ftime_from_timespec(&inode->i_mtime, &pObjInfo->ModificationTime);
     202    vbsf_time_to_linux(&inode->i_atime, &pObjInfo->AccessTime);
     203    vbsf_time_to_linux(&inode->i_ctime, &pObjInfo->ChangeTime);
     204    vbsf_time_to_linux(&inode->i_mtime, &pObjInfo->ModificationTime);
    183205    sf_i->BirthTime = pObjInfo->BirthTime;
    184206}
     
    192214 * @todo sort out the inode locking situation.
    193215 */
    194 static void sf_update_inode(struct inode *pInode, struct sf_inode_info *pInodeInfo, PSHFLFSOBJINFO pObjInfo,
    195                             struct vbsf_super_info *sf_g, bool fInodeLocked)
     216static void vbsf_update_inode(struct inode *pInode, struct sf_inode_info *pInodeInfo, PSHFLFSOBJINFO pObjInfo,
     217                              struct vbsf_super_info *sf_g, bool fInodeLocked)
    196218{
    197219    PCSHFLFSOBJATTR pAttr = &pObjInfo->Attr;
     
    209231     */
    210232    if (RTFS_IS_DIRECTORY(pAttr->fMode))
    211         fMode = sf_convert_file_mode(pAttr->fMode, sf_g->dmode, sf_g->dmask, S_IFDIR);
     233        fMode = sf_file_mode_to_linux(pAttr->fMode, sf_g->dmode, sf_g->dmask, S_IFDIR);
    212234#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 8)
    213235    else if (RTFS_IS_SYMLINK(pAttr->fMode))
    214236        /** @todo r=bird: Aren't System V symlinks w/o any mode mask? IIRC there is
    215237         *        no lchmod on Linux. */
    216         fMode = sf_convert_file_mode(pAttr->fMode, sf_g->fmode, sf_g->fmask, S_IFLNK);
     238        fMode = sf_file_mode_to_linux(pAttr->fMode, sf_g->fmode, sf_g->fmask, S_IFLNK);
    217239#endif
    218240    else
    219         fMode = sf_convert_file_mode(pAttr->fMode, sf_g->fmode, sf_g->fmask, S_IFREG);
     241        fMode = sf_file_mode_to_linux(pAttr->fMode, sf_g->fmode, sf_g->fmask, S_IFREG);
    220242
    221243    if (fMode == pInode->i_mode) {
     
    225247            pInode->i_mode = fMode;
    226248        else {
    227             SFLOGFLOW(("sf_update_inode: Changed from %o to %o (%s)\n",
    228                    pInode->i_mode & S_IFMT, fMode & S_IFMT, pInodeInfo->path->String.ach));
     249            SFLOGFLOW(("vbsf_update_inode: Changed from %o to %o (%s)\n",
     250                       pInode->i_mode & S_IFMT, fMode & S_IFMT, pInodeInfo->path->String.ach));
    229251            /** @todo we probably need to be more drastic... */
    230             sf_init_inode(pInode, pInodeInfo, pObjInfo, sf_g);
     252            vbsf_init_inode(pInode, pInodeInfo, pObjInfo, sf_g);
    231253
    232254#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
     
    248270     * Update the timestamps.
    249271     */
    250     sf_ftime_from_timespec(&pInode->i_atime, &pObjInfo->AccessTime);
    251     sf_ftime_from_timespec(&pInode->i_ctime, &pObjInfo->ChangeTime);
    252     sf_ftime_from_timespec(&pInode->i_mtime, &pObjInfo->ModificationTime);
     272    vbsf_time_to_linux(&pInode->i_atime, &pObjInfo->AccessTime);
     273    vbsf_time_to_linux(&pInode->i_ctime, &pObjInfo->ChangeTime);
     274    vbsf_time_to_linux(&pInode->i_mtime, &pObjInfo->ModificationTime);
    253275    pInodeInfo->BirthTime = pObjInfo->BirthTime;
    254276
     
    267289
    268290/** @note Currently only used for the root directory during (re-)mount.  */
    269 int sf_stat(const char *caller, struct vbsf_super_info *sf_g,
    270             SHFLSTRING *path, PSHFLFSOBJINFO result, int ok_to_fail)
     291int vbsf_stat(const char *caller, struct vbsf_super_info *sf_g, SHFLSTRING *path, PSHFLFSOBJINFO result, int ok_to_fail)
    271292{
    272293    int rc;
     
    313334 * @sa sf_inode_revalidate()
    314335 */
    315 int sf_inode_revalidate_worker(struct dentry *dentry, bool fForced)
     336int vbsf_inode_revalidate_worker(struct dentry *dentry, bool fForced)
    316337{
    317338    int rc;
     
    335356             * Try get a handle we can query, any kind of handle will do here.
    336357             */
    337             struct sf_handle *pHandle = sf_handle_find(sf_i, 0, 0);
     358            struct sf_handle *pHandle = vbsf_handle_find(sf_i, 0, 0);
    338359            if (pHandle) {
    339360                /* Query thru pHandle. */
     
    346367                         * Reset the TTL and copy the info over into the inode structure.
    347368                         */
    348                         sf_update_inode(pInode, sf_i, &pReq->ObjInfo, sf_g, true /*fInodeLocked??*/);
     369                        vbsf_update_inode(pInode, sf_i, &pReq->ObjInfo, sf_g, true /*fInodeLocked??*/);
    349370                    } else if (rc == VERR_INVALID_HANDLE) {
    350371                        rc = -ENOENT; /* Restore.*/
     
    356377                } else
    357378                    rc = -ENOMEM;
    358                 sf_handle_release(pHandle, sf_g, "sf_inode_revalidate_worker");
     379                vbsf_handle_release(pHandle, sf_g, "vbsf_inode_revalidate_worker");
    359380
    360381            } else {
     
    374395                             * Reset the TTL and copy the info over into the inode structure.
    375396                             */
    376                             sf_update_inode(pInode, sf_i, &pReq->CreateParms.Info,
     397                            vbsf_update_inode(pInode, sf_i, &pReq->CreateParms.Info,
    377398                                    sf_g, true /*fInodeLocked??*/);
    378399                            rc = 0;
     
    404425 *
    405426 * This is called directly as inode-op on 2.4, indirectly as dir-op
    406  * sf_dentry_revalidate() on 2.4/2.6.  The job is to find out whether
     427 * vbsf_dentry_revalidate() on 2.4/2.6.  The job is to find out whether
    407428 * dentry/inode is still valid.  The test fails if @a dentry does not have an
    408  * inode or sf_stat() is unsuccessful, otherwise we return success and update
     429 * inode or vbsf_stat() is unsuccessful, otherwise we return success and update
    409430 * inode attributes.
    410431 */
    411 int sf_inode_revalidate(struct dentry *dentry)
    412 {
    413     return sf_inode_revalidate_worker(dentry, false /*fForced*/);
     432int vbsf_inode_revalidate(struct dentry *dentry)
     433{
     434    return vbsf_inode_revalidate_worker(dentry, false /*fForced*/);
    414435}
    415436
     
    419440 * is quite a bit faster.
    420441 */
    421 int sf_inode_revalidate_with_handle(struct dentry *dentry, SHFLHANDLE hHostFile, bool fForced, bool fInodeLocked)
     442int vbsf_inode_revalidate_with_handle(struct dentry *dentry, SHFLHANDLE hHostFile, bool fForced, bool fInodeLocked)
    422443{
    423444    int err;
     
    451472                     * Reset the TTL and copy the info over into the inode structure.
    452473                     */
    453                     sf_update_inode(pInode, sf_i, &pReq->ObjInfo, sf_g, fInodeLocked);
     474                    vbsf_update_inode(pInode, sf_i, &pReq->ObjInfo, sf_g, fInodeLocked);
    454475                } else {
    455476                    LogFunc(("VbglR0SfHostReqQueryObjInfo failed on %#RX64: %Rrc\n", hHostFile, err));
     
    471492
    472493# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
    473 int sf_getattr(const struct path *path, struct kstat *kstat, u32 request_mask, unsigned int flags)
     494int vbsf_inode_getattr(const struct path *path, struct kstat *kstat, u32 request_mask, unsigned int flags)
    474495# else
    475 int sf_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *kstat)
     496int vbsf_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *kstat)
    476497# endif
    477498{
     
    482503
    483504# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
    484     SFLOGFLOW(("sf_getattr: dentry=%p request_mask=%#x flags=%#x\n", dentry, request_mask, flags));
     505    SFLOGFLOW(("vbsf_inode_setattr: dentry=%p request_mask=%#x flags=%#x\n", dentry, request_mask, flags));
    485506# else
    486     SFLOGFLOW(("sf_getattr: dentry=%p\n", dentry));
     507    SFLOGFLOW(("vbsf_inode_setattr: dentry=%p\n", dentry));
    487508# endif
    488509
     
    494515    switch (flags & AT_STATX_SYNC_TYPE) {
    495516        default:
    496             rc = sf_inode_revalidate_worker(dentry, false /*fForced*/);
     517            rc = vbsf_inode_revalidate_worker(dentry, false /*fForced*/);
    497518            break;
    498519
    499520        case AT_STATX_FORCE_SYNC:
    500             rc = sf_inode_revalidate_worker(dentry, true /*fForced*/);
     521            rc = vbsf_inode_revalidate_worker(dentry, true /*fForced*/);
    501522            break;
    502523
     
    506527    }
    507528# else
    508     rc = sf_inode_revalidate_worker(dentry, false /*fForced*/);
     529    rc = vbsf_inode_revalidate_worker(dentry, false /*fForced*/);
    509530# endif
    510531    if (rc == 0) {
     
    517538            struct sf_inode_info *pInodeInfo = GET_INODE_INFO(dentry->d_inode);
    518539            if (pInodeInfo) {
    519                 sf_ftime_from_timespec(&kstat->btime, &pInodeInfo->BirthTime);
     540                vbsf_time_to_linux(&kstat->btime, &pInodeInfo->BirthTime);
    520541                kstat->result_mask |= STATX_BTIME;
    521542            }
     
    551572}
    552573
    553 int sf_setattr(struct dentry *dentry, struct iattr *iattr)
     574int vbsf_inode_setattr(struct dentry *dentry, struct iattr *iattr)
    554575{
    555576    struct vbsf_super_info *sf_g;
     
    611632     * vbsf.cpp */
    612633    if (iattr->ia_valid & (ATTR_MODE | ATTR_ATIME | ATTR_MTIME)) {
    613 # define mode_set(r) ((iattr->ia_mode & (S_##r)) ? RTFS_UNIX_##r : 0)
    614 
    615634        RT_ZERO(*pInfo);
     635
    616636        if (iattr->ia_valid & ATTR_MODE) {
    617 /** @todo we've got code for this elsewhere...   */
    618             pInfo->Attr.fMode = mode_set(IRUSR);
    619             pInfo->Attr.fMode |= mode_set(IWUSR);
    620             pInfo->Attr.fMode |= mode_set(IXUSR);
    621             pInfo->Attr.fMode |= mode_set(IRGRP);
    622             pInfo->Attr.fMode |= mode_set(IWGRP);
    623             pInfo->Attr.fMode |= mode_set(IXGRP);
    624             pInfo->Attr.fMode |= mode_set(IROTH);
    625             pInfo->Attr.fMode |= mode_set(IWOTH);
    626             pInfo->Attr.fMode |= mode_set(IXOTH);
    627 
     637            pInfo->Attr.fMode = sf_access_permissions_to_vbox(iattr->ia_mode);
    628638            if (iattr->ia_mode & S_IFDIR)
    629639                pInfo->Attr.fMode |= RTFS_TYPE_DIRECTORY;
     640            else if (iattr->ia_mode & S_IFLNK)
     641                pInfo->Attr.fMode |= RTFS_TYPE_SYMLINK;
    630642            else
    631643                pInfo->Attr.fMode |= RTFS_TYPE_FILE;
     
    633645
    634646        if (iattr->ia_valid & ATTR_ATIME)
    635             sf_timespec_from_ftime(&pInfo->AccessTime, &iattr->ia_atime);
     647            vbsf_time_to_vbox(&pInfo->AccessTime, &iattr->ia_atime);
    636648        if (iattr->ia_valid & ATTR_MTIME)
    637             sf_timespec_from_ftime(&pInfo->ModificationTime, &iattr->ia_mtime);
     649            vbsf_time_to_vbox(&pInfo->ModificationTime, &iattr->ia_mtime);
    638650        /* ignore ctime (inode change time) as it can't be set from userland anyway */
    639651
     
    652664            err = -RTErrConvertToErrno(vrc);
    653665            LogFunc(("VbglR0SfHostReqSetFileSize(%s, %#llx) failed vrc=%Rrc err=%d\n",
    654                  sf_i->path->String.ach, (unsigned long long)iattr->ia_size, vrc, err));
     666                     sf_i->path->String.ach, (unsigned long long)iattr->ia_size, vrc, err));
    655667            goto fail1;
    656668        }
     
    672684     * dentry and all its parent entries are valid and could touch their timestamps
    673685     * extending their TTL (CIFS does that). */
    674     return sf_inode_revalidate_worker(dentry, true /*fForced*/);
     686    return vbsf_inode_revalidate_worker(dentry, true /*fForced*/);
    675687
    676688 fail1:
     
    686698#endif /* >= 2.6.0 */
    687699
    688 static int sf_make_path(const char *caller, struct sf_inode_info *sf_i,
    689                         const char *d_name, size_t d_len, SHFLSTRING **result)
     700static int vbsf_make_path(const char *caller, struct sf_inode_info *sf_i,
     701                          const char *d_name, size_t d_len, SHFLSTRING **result)
    690702{
    691703    size_t path_len, shflstring_len;
     
    737749 * [dentry] contains string encoded in coding system that corresponds
    738750 * to [sf_g]->nls, we must convert it to UTF8 here and pass down to
    739  * [sf_make_path] which will allocate SHFLSTRING and fill it in
    740  */
    741 int sf_path_from_dentry(const char *caller, struct vbsf_super_info *sf_g,
    742                         struct sf_inode_info *sf_i, struct dentry *dentry,
    743                         SHFLSTRING **result)
     751 * [vbsf_make_path] which will allocate SHFLSTRING and fill it in
     752 */
     753int vbsf_path_from_dentry(const char *caller, struct vbsf_super_info *sf_g, struct sf_inode_info *sf_i,
     754                          struct dentry *dentry, SHFLSTRING **result)
    744755{
    745756    int err;
     
    808819    }
    809820
    810     err = sf_make_path(caller, sf_i, name, len, result);
     821    err = vbsf_make_path(caller, sf_i, name, len, result);
    811822    if (name != d_name)
    812823        kfree(name);
     
    819830}
    820831
    821 int sf_nlscpy(struct vbsf_super_info *sf_g,
    822               char *name, size_t name_bound_len,
    823               const unsigned char *utf8_name, size_t utf8_len)
     832int vbsf_nlscpy(struct vbsf_super_info *sf_g, char *name, size_t name_bound_len, const unsigned char *utf8_name, size_t utf8_len)
    824833{
    825834    if (sf_g->nls) {
     
    878887}
    879888
    880 static struct sf_dir_buf *sf_dir_buf_alloc(void)
     889static struct sf_dir_buf *vbsf_dir_buf_alloc(void)
    881890{
    882891    struct sf_dir_buf *b;
     
    902911}
    903912
    904 static void sf_dir_buf_free(struct sf_dir_buf *b)
     913static void vbsf_dir_buf_free(struct sf_dir_buf *b)
    905914{
    906915    BUG_ON(!b || !b->buf);
     
    915924 * Free the directory buffer.
    916925 */
    917 void sf_dir_info_free(struct sf_dir_info *p)
     926void vbsf_dir_info_free(struct sf_dir_info *p)
    918927{
    919928    struct list_head *list, *pos, *tmp;
     
    925934
    926935        b = list_entry(pos, struct sf_dir_buf, head);
    927         sf_dir_buf_free(b);
     936        vbsf_dir_buf_free(b);
    928937    }
    929938    kfree(p);
     
    933942 * Empty (but not free) the directory buffer.
    934943 */
    935 void sf_dir_info_empty(struct sf_dir_info *p)
     944void vbsf_dir_info_empty(struct sf_dir_info *p)
    936945{
    937946    struct list_head *list, *pos, *tmp;
     
    950959 * Create a new directory buffer descriptor.
    951960 */
    952 struct sf_dir_info *sf_dir_info_alloc(void)
     961struct sf_dir_info *vbsf_dir_info_alloc(void)
    953962{
    954963    struct sf_dir_info *p;
     
    968977 * Search for an empty directory content buffer.
    969978 */
    970 static struct sf_dir_buf *sf_get_empty_dir_buf(struct sf_dir_info *sf_d)
     979static struct sf_dir_buf *vbsf_get_empty_dir_buf(struct sf_dir_info *sf_d)
    971980{
    972981    struct list_head *list, *pos;
     
    990999/** @todo r=bird: Why on earth do we read in the entire directory???  This
    9911000 *        cannot be healthy for like big directory and such... */
    992 int sf_dir_read_all(struct vbsf_super_info *sf_g, struct sf_inode_info *sf_i,
    993                     struct sf_dir_info *sf_d, SHFLHANDLE handle)
     1001int vbsf_dir_read_all(struct vbsf_super_info *sf_g, struct sf_inode_info *sf_i, struct sf_dir_info *sf_d, SHFLHANDLE handle)
    9941002{
    9951003    int err;
     
    9981006
    9991007    TRACE();
    1000     err = sf_make_path(__func__, sf_i, "*", 1, &mask);
     1008    err = vbsf_make_path(__func__, sf_i, "*", 1, &mask);
    10011009    if (err)
    10021010        goto fail0;
     
    10091017        struct sf_dir_buf *b;
    10101018
    1011         b = sf_get_empty_dir_buf(sf_d);
     1019        b = vbsf_get_empty_dir_buf(sf_d);
    10121020        if (!b) {
    1013             b = sf_dir_buf_alloc();
     1021            b = vbsf_dir_buf_alloc();
    10141022            if (!b) {
    10151023                err = -ENOMEM;
     
    10491057 * This is called during name resolution/lookup to check if the @a dentry in the
    10501058 * cache is still valid.  The actual validation is job is handled by
    1051  * sf_inode_revalidate_worker().
    1052  */
    1053 static int
     1059 * vbsf_inode_revalidate_worker().
     1060 */
    10541061#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
    1055 sf_dentry_revalidate(struct dentry *dentry, unsigned flags)
     1062static int vbsf_dentry_revalidate(struct dentry *dentry, unsigned flags)
    10561063#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    1057 sf_dentry_revalidate(struct dentry *dentry, struct nameidata *nd)
     1064static int vbsf_dentry_revalidate(struct dentry *dentry, struct nameidata *nd)
    10581065#else
    1059 sf_dentry_revalidate(struct dentry *dentry, int flags)
     1066static int vbsf_dentry_revalidate(struct dentry *dentry, int flags)
    10601067#endif
    10611068{
     
    10671074
    10681075    Assert(dentry);
    1069     SFLOGFLOW(("sf_dentry_revalidate: %p %#x %s\n", dentry, flags, dentry->d_inode ? GET_INODE_INFO(dentry->d_inode)->path->String.ach : "<negative>"));
     1076    SFLOGFLOW(("vbsf_dentry_revalidate: %p %#x %s\n", dentry, flags, dentry->d_inode ? GET_INODE_INFO(dentry->d_inode)->path->String.ach : "<negative>"));
    10701077
    10711078    /*
     
    10801087    if (flags & LOOKUP_RCU) {
    10811088        rc = -ECHILD;
    1082         SFLOGFLOW(("sf_dentry_revalidate: RCU -> -ECHILD\n"));
     1089        SFLOGFLOW(("vbsf_dentry_revalidate: RCU -> -ECHILD\n"));
    10831090    } else
    10841091#endif
     
    10981105             */
    10991106            //struct sf_inode_info *sf_i = GET_INODE_INFO(pInode);
    1100             unsigned long const     cJiffiesAge = sf_dentry_get_update_jiffies(dentry) - jiffies;
     1107            unsigned long const     cJiffiesAge = vbsf_dentry_get_update_jiffies(dentry) - jiffies;
    11011108            struct vbsf_super_info *sf_g        = VBSF_GET_SUPER_INFO(dentry->d_sb);
    11021109            if (cJiffiesAge < sf_g->ttl) {
    1103                 SFLOGFLOW(("sf_dentry_revalidate: age: %lu vs. TTL %lu -> 1\n", cJiffiesAge, sf_g->ttl));
     1110                SFLOGFLOW(("vbsf_dentry_revalidate: age: %lu vs. TTL %lu -> 1\n", cJiffiesAge, sf_g->ttl));
    11041111                rc = 1;
    1105             } else if (!sf_inode_revalidate_worker(dentry, true /*fForced*/)) {
    1106                 sf_dentry_set_update_jiffies(dentry, jiffies); /** @todo get jiffies from inode. */
    1107                 SFLOGFLOW(("sf_dentry_revalidate: age: %lu vs. TTL %lu -> reval -> 1\n", cJiffiesAge, sf_g->ttl));
     1112            } else if (!vbsf_inode_revalidate_worker(dentry, true /*fForced*/)) {
     1113                vbsf_dentry_set_update_jiffies(dentry, jiffies); /** @todo get jiffies from inode. */
     1114                SFLOGFLOW(("vbsf_dentry_revalidate: age: %lu vs. TTL %lu -> reval -> 1\n", cJiffiesAge, sf_g->ttl));
    11081115                rc = 1;
    11091116            } else {
    1110                 SFLOGFLOW(("sf_dentry_revalidate: age: %lu vs. TTL %lu -> reval -> 0\n", cJiffiesAge, sf_g->ttl));
     1117                SFLOGFLOW(("vbsf_dentry_revalidate: age: %lu vs. TTL %lu -> reval -> 0\n", cJiffiesAge, sf_g->ttl));
    11111118                rc = 0;
    11121119            }
     
    11281135#endif
    11291136            {
    1130                 SFLOGFLOW(("sf_dentry_revalidate: negative: create or rename target -> 0\n"));
     1137                SFLOGFLOW(("vbsf_dentry_revalidate: negative: create or rename target -> 0\n"));
    11311138                rc = 0;
    11321139            } else {
    11331140                /* Can we skip revalidation based on TTL? */
    1134                 unsigned long const     cJiffiesAge = sf_dentry_get_update_jiffies(dentry) - jiffies;
     1141                unsigned long const     cJiffiesAge = vbsf_dentry_get_update_jiffies(dentry) - jiffies;
    11351142                struct vbsf_super_info *sf_g        = VBSF_GET_SUPER_INFO(dentry->d_sb);
    11361143                if (cJiffiesAge < sf_g->ttl) {
    1137                     SFLOGFLOW(("sf_dentry_revalidate: negative: age: %lu vs. TTL %lu -> 1\n", cJiffiesAge, sf_g->ttl));
     1144                    SFLOGFLOW(("vbsf_dentry_revalidate: negative: age: %lu vs. TTL %lu -> 1\n", cJiffiesAge, sf_g->ttl));
    11381145                    rc = 1;
    11391146                } else {
     
    11411148                       have the caller kick it out. */
    11421149                    /** @todo stat the direntry and see if it exists now. */
    1143                     SFLOGFLOW(("sf_dentry_revalidate: negative: age: %lu vs. TTL %lu -> 0\n", cJiffiesAge, sf_g->ttl));
     1150                    SFLOGFLOW(("vbsf_dentry_revalidate: negative: age: %lu vs. TTL %lu -> 0\n", cJiffiesAge, sf_g->ttl));
    11441151                    rc = 0;
    11451152                }
     
    11541161/** For logging purposes only. */
    11551162# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
    1156 static int sf_dentry_delete(const struct dentry *pDirEntry)
     1163static int vbsf_dentry_delete(const struct dentry *pDirEntry)
    11571164# else
    1158 static int sf_dentry_delete(struct dentry *pDirEntry)
     1165static int vbsf_dentry_delete(struct dentry *pDirEntry)
    11591166# endif
    11601167{
    1161     SFLOGFLOW(("sf_dentry_delete: %p\n", pDirEntry));
     1168    SFLOGFLOW(("vbsf_dentry_delete: %p\n", pDirEntry));
    11621169    return 0;
    11631170}
     
    11651172# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
    11661173/** For logging purposes only. */
    1167 static int sf_dentry_init(struct dentry *pDirEntry)
    1168 {
    1169     SFLOGFLOW(("sf_dentry_init: %p\n", pDirEntry));
     1174static int vbsf_dentry_init(struct dentry *pDirEntry)
     1175{
     1176    SFLOGFLOW(("vbsf_dentry_init: %p\n", pDirEntry));
    11701177    return 0;
    11711178}
     
    11791186 * Since 2.6.38 this is used via the super_block::s_d_op member.
    11801187 */
    1181 struct dentry_operations sf_dentry_ops = {
    1182     .d_revalidate = sf_dentry_revalidate,
     1188struct dentry_operations vbsf_dentry_ops = {
     1189    .d_revalidate = vbsf_dentry_revalidate,
    11831190#ifdef SFLOG_ENABLED
    1184     .d_delete = sf_dentry_delete,
     1191    .d_delete = vbsf_dentry_delete,
    11851192# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
    1186     .d_init = sf_dentry_init,
     1193    .d_init = vbsf_dentry_init,
    11871194# endif
    11881195#endif
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c

    r77526 r77529  
    5858*   Global Variables                                                                                                             *
    5959*********************************************************************************************************************************/
    60 VBGLSFCLIENT client_handle;
    61 VBGLSFCLIENT g_SfClient;      /* temporary? */
    62 
    63 uint32_t g_fHostFeatures = 0; /* temporary? */
     60VBGLSFCLIENT g_SfClient;
     61uint32_t     g_fHostFeatures = 0;
    6462
    6563/** Protects all the sf_inode_info::HandleList lists. */
    66 spinlock_t g_SfHandleLock;
     64spinlock_t   g_SfHandleLock;
    6765
    6866#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 52)
    69 static int g_fFollowSymlinks = 0;
     67static int   g_fFollowSymlinks = 0;
    7068#endif
    7169
     
    7876 * Copies options from the mount info structure into @a sf_g.
    7977 *
    80  * This is used both by sf_super_info_alloc() and sf_remount_fs().
    81  */
    82 static void sf_super_info_copy_remount_options(struct vbsf_super_info *sf_g, struct vbsf_mount_info_new *info)
     78 * This is used both by vbsf_super_info_alloc() and vbsf_remount_fs().
     79 */
     80static void vbsf_super_info_copy_remount_options(struct vbsf_super_info *sf_g, struct vbsf_mount_info_new *info)
    8381{
    8482    sf_g->ttl_msec = info->ttl;
     
    132130
    133131/* allocate super info, try to map host share */
    134 static int sf_super_info_alloc(struct vbsf_mount_info_new *info, struct vbsf_super_info **sf_gp)
     132static int vbsf_super_info_alloc(struct vbsf_mount_info_new *info, struct vbsf_super_info **sf_gp)
    135133{
    136134    int err, rc;
     
    218216
    219217    /* The rest is shared with remount. */
    220     sf_super_info_copy_remount_options(sf_g, info);
     218    vbsf_super_info_copy_remount_options(sf_g, info);
    221219
    222220    *sf_gp = sf_g;
     
    235233
    236234/* unmap the share and free super info [sf_g] */
    237 static void sf_super_info_free(struct vbsf_super_info *sf_g)
     235static void vbsf_super_info_free(struct vbsf_super_info *sf_g)
    238236{
    239237    int rc;
     
    254252 * Initialize backing device related matters.
    255253 */
    256 static int sf_init_backing_dev(struct super_block *sb, struct vbsf_super_info *sf_g)
     254static int vbsf_init_backing_dev(struct super_block *sb, struct vbsf_super_info *sf_g)
    257255{
    258256    int rc = 0;
     
    320318
    321319/**
    322  * Undoes what sf_init_backing_dev did.
    323  */
    324 static void sf_done_backing_dev(struct super_block *sb, struct vbsf_super_info *sf_g)
     320 * Undoes what vbsf_init_backing_dev did.
     321 */
     322static void vbsf_done_backing_dev(struct super_block *sb, struct vbsf_super_info *sf_g)
    325323{
    326324#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) && LINUX_VERSION_CODE <= KERNEL_VERSION(3, 19, 0)
     
    331329
    332330/**
    333  * This is called by sf_read_super_24() and sf_read_super_26() when vfs mounts
     331 * This is called by vbsf_read_super_24() and vbsf_read_super_26() when vfs mounts
    334332 * the fs and wants to read super_block.
    335333 *
    336  * Calls sf_super_info_alloc() to map the folder and allocate super information
     334 * Calls vbsf_super_info_alloc() to map the folder and allocate super information
    337335 * structure.
    338336 *
     
    341339 * Should respect @a flags.
    342340 */
    343 static int sf_read_super_aux(struct super_block *sb, void *data, int flags)
     341static int vbsf_read_super_aux(struct super_block *sb, void *data, int flags)
    344342{
    345343    int err;
     
    365363    }
    366364
    367     err = sf_super_info_alloc(info, &sf_g);
     365    err = vbsf_super_info_alloc(info, &sf_g);
    368366    if (err)
    369367        goto fail0;
     
    394392#endif
    395393
    396     err = sf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0);
     394    err = vbsf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0);
    397395    if (err) {
    398396        LogFunc(("could not stat root of share\n"));
     
    414412    sb->s_op = &sf_super_ops;
    415413#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
    416     sb->s_d_op = &sf_dentry_ops;
     414    sb->s_d_op = &vbsf_dentry_ops;
    417415#endif
    418416
     
    428426    }
    429427
    430     if (sf_init_backing_dev(sb, sf_g)) {
     428    if (vbsf_init_backing_dev(sb, sf_g)) {
    431429        err = -EINVAL;
    432430        LogFunc(("could not init bdi\n"));
     
    437435    }
    438436
    439     sf_init_inode(iroot, sf_i, &fsinfo, sf_g);
     437    vbsf_init_inode(iroot, sf_i, &fsinfo, sf_g);
    440438    SET_INODE_INFO(iroot, sf_i);
    441439
     
    463461
    464462 fail5:
    465     sf_done_backing_dev(sb, sf_g);
     463    vbsf_done_backing_dev(sb, sf_g);
    466464
    467465 fail4:
     
    476474
    477475 fail1:
    478     sf_super_info_free(sf_g);
     476    vbsf_super_info_free(sf_g);
    479477
    480478 fail0:
     
    489487 */
    490488#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
    491 static void sf_evict_inode(struct inode *inode)
     489static void vbsf_evict_inode(struct inode *inode)
    492490#else
    493 static void sf_clear_inode(struct inode *inode)
     491static void vbsf_clear_inode(struct inode *inode)
    494492#endif
    495493{
     
    519517        BUG_ON(!sf_i->path);
    520518        kfree(sf_i->path);
    521         sf_handle_drop_chain(sf_i);
     519        vbsf_handle_drop_chain(sf_i);
    522520# ifdef VBOX_STRICT
    523521        sf_i->u32Magic = SF_INODE_INFO_MAGIC_DEAD;
     
    533531   job to properly fill then [inode] */
    534532#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
    535 static void sf_read_inode(struct inode *inode)
    536 {
    537 }
    538 #endif
    539 
    540 
    541 /* vfs is done with [sb] (umount called) call [sf_super_info_free] to unmap
     533static void vbsf_read_inode(struct inode *inode)
     534{
     535}
     536#endif
     537
     538
     539/* vfs is done with [sb] (umount called) call [vbsf_super_info_free] to unmap
    542540   the folder and free [sf_g] */
    543 static void sf_put_super(struct super_block *sb)
     541static void vbsf_put_super(struct super_block *sb)
    544542{
    545543    struct vbsf_super_info *sf_g;
     
    547545    sf_g = VBSF_GET_SUPER_INFO(sb);
    548546    BUG_ON(!sf_g);
    549     sf_done_backing_dev(sb, sf_g);
    550     sf_super_info_free(sf_g);
     547    vbsf_done_backing_dev(sb, sf_g);
     548    vbsf_super_info_free(sf_g);
    551549}
    552550
     
    556554 */
    557555#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
    558 static int sf_statfs(struct dentry *dentry, struct kstatfs *stat)
     556static int vbsf_statfs(struct dentry *dentry, struct kstatfs *stat)
    559557#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 73)
    560 static int sf_statfs(struct super_block *sb, struct kstatfs *stat)
     558static int vbsf_statfs(struct super_block *sb, struct kstatfs *stat)
    561559#else
    562 static int sf_statfs(struct super_block *sb, struct statfs *stat)
     560static int vbsf_statfs(struct super_block *sb, struct statfs *stat)
    563561#endif
    564562{
     
    603601}
    604602
    605 static int sf_remount_fs(struct super_block *sb, int *flags, char *data)
     603static int vbsf_remount_fs(struct super_block *sb, int *flags, char *data)
    606604{
    607605#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 23)
     
    620618            && info->signature[1] == VBSF_MOUNT_SIGNATURE_BYTE_1
    621619            && info->signature[2] == VBSF_MOUNT_SIGNATURE_BYTE_2) {
    622             sf_super_info_copy_remount_options(sf_g, info);
     620            vbsf_super_info_copy_remount_options(sf_g, info);
    623621        }
    624622    }
     
    629627
    630628    sf_i = GET_INODE_INFO(iroot);
    631     err = sf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0);
     629    err = vbsf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0);
    632630    BUG_ON(err != 0);
    633     sf_init_inode(iroot, sf_i, &fsinfo, sf_g);
     631    vbsf_init_inode(iroot, sf_i, &fsinfo, sf_g);
    634632    /*unlock_new_inode(iroot); */
    635633    return 0;
     
    647645 */
    648646#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
    649 static int sf_show_options(struct seq_file *m, struct vfsmount *mnt)
     647static int vbsf_show_options(struct seq_file *m, struct vfsmount *mnt)
    650648#else
    651 static int sf_show_options(struct seq_file *m, struct dentry *root)
     649static int vbsf_show_options(struct seq_file *m, struct dentry *root)
    652650#endif
    653651{
     
    676674static struct super_operations sf_super_ops = {
    677675#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
    678     .clear_inode = sf_clear_inode,
     676    .clear_inode = vbsf_clear_inode,
    679677#else
    680     .evict_inode = sf_evict_inode,
     678    .evict_inode = vbsf_evict_inode,
    681679#endif
    682680#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
    683     .read_inode = sf_read_inode,
    684 #endif
    685     .put_super = sf_put_super,
    686     .statfs = sf_statfs,
    687     .remount_fs = sf_remount_fs,
    688     .show_options = sf_show_options
     681    .read_inode = vbsf_read_inode,
     682#endif
     683    .put_super = vbsf_put_super,
     684    .statfs = vbsf_statfs,
     685    .remount_fs = vbsf_remount_fs,
     686    .show_options = vbsf_show_options
    689687};
    690688
     
    696694#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 4)
    697695
    698 static int sf_read_super_26(struct super_block *sb, void *data, int flags)
     696static int vbsf_read_super_26(struct super_block *sb, void *data, int flags)
    699697{
    700698    int err;
    701699
    702700    TRACE();
    703     err = sf_read_super_aux(sb, data, flags);
     701    err = vbsf_read_super_aux(sb, data, flags);
    704702    if (err)
    705         printk(KERN_DEBUG "sf_read_super_aux err=%d\n", err);
     703        printk(KERN_DEBUG "vbsf_read_super_aux err=%d\n", err);
    706704
    707705    return err;
     
    709707
    710708# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
    711 static struct super_block *sf_get_sb(struct file_system_type *fs_type,
    712                      int flags, const char *dev_name,
    713                      void *data)
    714 {
    715     TRACE();
    716     return get_sb_nodev(fs_type, flags, data, sf_read_super_26);
     709static struct super_block *vbsf_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
     710{
     711    TRACE();
     712    return get_sb_nodev(fs_type, flags, data, vbsf_read_super_26);
    717713}
    718714# elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
    719 static int sf_get_sb(struct file_system_type *fs_type, int flags,
    720              const char *dev_name, void *data, struct vfsmount *mnt)
    721 {
    722     TRACE();
    723     return get_sb_nodev(fs_type, flags, data, sf_read_super_26, mnt);
     715static int vbsf_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, struct vfsmount *mnt)
     716{
     717    TRACE();
     718    return get_sb_nodev(fs_type, flags, data, vbsf_read_super_26, mnt);
    724719}
    725720# else /* LINUX_VERSION_CODE >= 2.6.39 */
    726 static struct dentry *sf_mount(struct file_system_type *fs_type, int flags,
    727                    const char *dev_name, void *data)
    728 {
    729     TRACE();
    730     return mount_nodev(fs_type, flags, data, sf_read_super_26);
     721static struct dentry *sf_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
     722{
     723    TRACE();
     724    return mount_nodev(fs_type, flags, data, vbsf_read_super_26);
    731725}
    732726# endif /* LINUX_VERSION_CODE >= 2.6.39 */
     
    736730    .name = "vboxsf",
    737731# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
    738     .get_sb = sf_get_sb,
     732    .get_sb = vbsf_get_sb,
    739733# else
    740734    .mount = sf_mount,
     
    745739#else  /* LINUX_VERSION_CODE < 2.5.4 */
    746740
    747 static struct super_block *sf_read_super_24(struct super_block *sb, void *data,
    748                         int flags)
     741static struct super_block *vbsf_read_super_24(struct super_block *sb, void *data, int flags)
    749742{
    750743    int err;
    751744
    752745    TRACE();
    753     err = sf_read_super_aux(sb, data, flags);
     746    err = vbsf_read_super_aux(sb, data, flags);
    754747    if (err) {
    755         printk(KERN_DEBUG "sf_read_super_aux err=%d\n", err);
     748        printk(KERN_DEBUG "vbsf_read_super_aux err=%d\n", err);
    756749        return NULL;
    757750    }
     
    760753}
    761754
    762 static DECLARE_FSTYPE(vboxsf_fs_type, "vboxsf", sf_read_super_24, 0);
     755static DECLARE_FSTYPE(vboxsf_fs_type, "vboxsf", vbsf_read_super_24, 0);
    763756
    764757#endif /* LINUX_VERSION_CODE < 2.5.4 */
     
    768761static int __init init(void)
    769762{
     763    int rcRet = 0;
    770764    int vrc;
    771     int rcRet = 0;
    772765    int err;
    773766
    774767    TRACE();
    775768
     769    AssertCompile(sizeof(struct vbsf_mount_info_new) <= PAGE_SIZE);
    776770    if (sizeof(struct vbsf_mount_info_new) > PAGE_SIZE) {
    777771        printk(KERN_ERR
     
    799793    }
    800794
    801     vrc = VbglR0SfConnect(&client_handle);
    802     g_SfClient = client_handle; /* temporary */
     795    vrc = VbglR0SfConnect(&g_SfClient);
    803796    if (RT_FAILURE(vrc)) {
    804797        LogRelFunc(("VbglR0SfConnect failed, vrc=%Rrc\n", vrc));
     
    815808    LogRelFunc(("g_fHostFeatures=%#x\n", g_fHostFeatures));
    816809
    817     vrc = VbglR0SfSetUtf8(&client_handle);
     810    vrc = VbglR0SfSetUtf8(&g_SfClient);
    818811    if (RT_FAILURE(vrc)) {
    819812        LogRelFunc(("VbglR0SfSetUtf8 failed, vrc=%Rrc\n", vrc));
     
    823816#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    824817    if (!g_fFollowSymlinks) {
    825         vrc = VbglR0SfSetSymlinks(&client_handle);
     818        vrc = VbglR0SfSetSymlinks(&g_SfClient);
    826819        if (RT_FAILURE(vrc)) {
    827820            printk(KERN_WARNING
     
    839832
    840833 fail2:
    841     VbglR0SfDisconnect(&client_handle);
    842     g_SfClient = client_handle; /* temporary */
     834    VbglR0SfDisconnect(&g_SfClient);
    843835
    844836 fail1:
     
    854846    TRACE();
    855847
    856     VbglR0SfDisconnect(&client_handle);
    857     g_SfClient = client_handle; /* temporary */
     848    VbglR0SfDisconnect(&g_SfClient);
    858849    VbglR0SfTerm();
    859850    unregister_filesystem(&vboxsf_fs_type);
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h

    r77526 r77529  
    127127 * For associating inodes with host handles.
    128128 *
    129  * This is necessary for address_space_operations::sf_writepage and allows
     129 * This is necessary for address_space_operations::vbsf_writepage and allows
    130130 * optimizing stat, lookups and other operations on open files and directories.
    131131 */
     
    166166    /** Some information was changed, update data on next revalidate */
    167167    bool force_restat;
    168     /** directory content changed, update the whole directory on next sf_getdent */
     168    /** directory content changed, update the whole directory on next vbsf_getdent */
    169169    bool force_reread;
    170170    /** The timestamp (jiffies) where the inode info was last updated. */
     
    173173    RTTIMESPEC              BirthTime;
    174174
    175     /** handle valid if a file was created with sf_create_aux until it will
    176      * be opened with sf_reg_open()
     175    /** handle valid if a file was created with vbsf_create_worker until it will
     176     * be opened with vbsf_reg_open()
    177177     * @todo r=bird: figure this one out...  */
    178178    SHFLHANDLE handle;
     
    187187};
    188188
     189#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) || defined(KERNEL_FC6)
     190/* FC6 kernel 2.6.18, vanilla kernel 2.6.19+ */
     191# define GET_INODE_INFO(i)       ((struct sf_inode_info *) (i)->i_private)
     192# define SET_INODE_INFO(i, sf_i) (i)->i_private = sf_i
     193#else
     194/* vanilla kernel up to 2.6.18 */
     195# define GET_INODE_INFO(i)       ((struct sf_inode_info *) (i)->u.generic_ip)
     196# define SET_INODE_INFO(i, sf_i) (i)->u.generic_ip = sf_i
     197#endif
     198
    189199struct sf_dir_info {
    190200    /** @todo sf_handle. */
     
    219229 * specific code (at least going back to 2.4.0).
    220230 */
    221 DECLINLINE(void) sf_dentry_set_update_jiffies(struct dentry *pDirEntry, unsigned long uToSet)
     231DECLINLINE(void) vbsf_dentry_set_update_jiffies(struct dentry *pDirEntry, unsigned long uToSet)
    222232{
    223233    pDirEntry->d_fsdata = (void *)uToSet;
     
    227237 * Get the update-jiffies value for a dentry.
    228238 */
    229 DECLINLINE(unsigned long) sf_dentry_get_update_jiffies(struct dentry *pDirEntry)
     239DECLINLINE(unsigned long) vbsf_dentry_get_update_jiffies(struct dentry *pDirEntry)
    230240{
    231241    return (unsigned long)pDirEntry->d_fsdata;
     
    237247 *                  we should increase the TTL for.
    238248 */
    239 DECLINLINE(void) sf_dentry_chain_increase_ttl(struct dentry *pDirEntry)
     249DECLINLINE(void) vbsf_dentry_chain_increase_ttl(struct dentry *pDirEntry)
    240250{
    241251#ifdef VBOX_STRICT
     
    245255    do {
    246256        Assert(pDirEntry->d_sb == pSuper);
    247         sf_dentry_set_update_jiffies(pDirEntry, uToSet);
     257        vbsf_dentry_set_update_jiffies(pDirEntry, uToSet);
    248258        pDirEntry = pDirEntry->d_parent;
    249259    } while (!IS_ROOT(pDirEntry));
     
    255265 *                  we should increase the TTL for.
    256266 */
    257 DECLINLINE(void) sf_dentry_chain_increase_parent_ttl(struct dentry *pDirEntry)
     267DECLINLINE(void) vbsf_dentry_chain_increase_parent_ttl(struct dentry *pDirEntry)
    258268{
    259269    Assert(!pDirEntry->d_parent || pDirEntry->d_parent->d_sb == pDirEntry->d_sb);
    260270    pDirEntry = pDirEntry->d_parent;
    261271    if (pDirEntry)
    262         sf_dentry_chain_increase_ttl(pDirEntry);
     272        vbsf_dentry_chain_increase_ttl(pDirEntry);
    263273}
    264274
    265275
    266276/* globals */
    267 extern VBGLSFCLIENT client_handle;
     277extern VBGLSFCLIENT g_SfClient;
    268278extern spinlock_t g_SfHandleLock;
    269279
    270280
    271281/* forward declarations */
    272 extern struct inode_operations sf_dir_iops;
    273 extern struct inode_operations sf_lnk_iops;
    274 extern struct inode_operations sf_reg_iops;
    275 extern struct file_operations sf_dir_fops;
    276 extern struct file_operations sf_reg_fops;
    277 extern struct dentry_operations sf_dentry_ops;
    278 extern struct address_space_operations sf_reg_aops;
    279 
    280 extern void              sf_handle_drop_chain(struct sf_inode_info *pInodeInfo);
    281 extern struct sf_handle *sf_handle_find(struct sf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear);
    282 extern uint32_t          sf_handle_release_slow(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller);
    283 extern void              sf_handle_append(struct sf_inode_info *pInodeInfo, struct sf_handle *pHandle);
     282extern struct inode_operations         vbsf_dir_iops;
     283extern struct inode_operations         vbsf_lnk_iops;
     284extern struct inode_operations         vbsf_reg_iops;
     285extern struct file_operations          vbsf_dir_fops;
     286extern struct file_operations          vbsf_reg_fops;
     287extern struct dentry_operations        vbsf_dentry_ops;
     288extern struct address_space_operations vbsf_reg_aops;
     289
     290extern void              vbsf_handle_drop_chain(struct sf_inode_info *pInodeInfo);
     291extern struct sf_handle *vbsf_handle_find(struct sf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear);
     292extern uint32_t          vbsf_handle_release_slow(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller);
     293extern void              vbsf_handle_append(struct sf_inode_info *pInodeInfo, struct sf_handle *pHandle);
    284294
    285295/**
     
    289299 * @param   pHandle         The handle to release.
    290300 * @param   sf_g            The info structure for the shared folder associated
    291  *                  with the handle.
     301 *                          with the handle.
    292302 * @param   pszCaller       The caller name (for logging failures).
    293303 */
    294 DECLINLINE(uint32_t) sf_handle_release(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller)
     304DECLINLINE(uint32_t) vbsf_handle_release(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller)
    295305{
    296306    uint32_t cRefs;
     
    304314    if (cRefs)
    305315        return cRefs;
    306     return sf_handle_release_slow(pHandle, sf_g, pszCaller);
    307 }
    308 
    309 extern void sf_init_inode(struct inode *inode, struct sf_inode_info *sf_i, PSHFLFSOBJINFO info, struct vbsf_super_info *sf_g);
    310 extern int sf_stat(const char *caller, struct vbsf_super_info *sf_g,
    311            SHFLSTRING * path, PSHFLFSOBJINFO result, int ok_to_fail);
    312 extern int sf_inode_revalidate(struct dentry *dentry);
    313 extern int sf_inode_revalidate_worker(struct dentry *dentry, bool fForced);
    314 extern int sf_inode_revalidate_with_handle(struct dentry *dentry, SHFLHANDLE hHostFile, bool fForced, bool fInodeLocked);
     316    return vbsf_handle_release_slow(pHandle, sf_g, pszCaller);
     317}
     318
     319extern void vbsf_init_inode(struct inode *inode, struct sf_inode_info *sf_i, PSHFLFSOBJINFO info, struct vbsf_super_info *sf_g);
     320extern int  vbsf_stat(const char *caller, struct vbsf_super_info *sf_g, SHFLSTRING * path, PSHFLFSOBJINFO result, int ok_to_fail);
     321extern int  vbsf_inode_revalidate(struct dentry *dentry);
     322extern int  vbsf_inode_revalidate_worker(struct dentry *dentry, bool fForced);
     323extern int  vbsf_inode_revalidate_with_handle(struct dentry *dentry, SHFLHANDLE hHostFile, bool fForced, bool fInodeLocked);
    315324#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    316325# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
    317 extern int sf_getattr(const struct path *path, struct kstat *kstat,
    318               u32 request_mask, unsigned int query_flags);
     326extern int  vbsf_inode_getattr(const struct path *path, struct kstat *kstat, u32 request_mask, unsigned int query_flags);
    319327# else
    320 extern int sf_getattr(struct vfsmount *mnt, struct dentry *dentry,
    321               struct kstat *kstat);
     328extern int  vbsf_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *kstat);
    322329# endif
    323 extern int sf_setattr(struct dentry *dentry, struct iattr *iattr);
    324 #endif
    325 extern int sf_path_from_dentry(const char *caller, struct vbsf_super_info *sf_g,
    326                    struct sf_inode_info *sf_i,
    327                    struct dentry *dentry, SHFLSTRING ** result);
    328 extern int sf_nlscpy(struct vbsf_super_info *sf_g, char *name,
    329              size_t name_bound_len, const unsigned char *utf8_name,
    330              size_t utf8_len);
    331 extern void sf_dir_info_free(struct sf_dir_info *p);
    332 extern void sf_dir_info_empty(struct sf_dir_info *p);
    333 extern struct sf_dir_info *sf_dir_info_alloc(void);
    334 extern int sf_dir_read_all(struct vbsf_super_info *sf_g,
    335                struct sf_inode_info *sf_i, struct sf_dir_info *sf_d,
    336                SHFLHANDLE handle);
    337 
    338 #ifdef __cplusplus
    339 # define CMC_API __attribute__ ((cdecl, regparm (0)))
    340 #else
    341 # define CMC_API __attribute__ ((regparm (0)))
    342 #endif
     330extern int  vbsf_inode_setattr(struct dentry *dentry, struct iattr *iattr);
     331#endif
     332extern int  vbsf_path_from_dentry(const char *caller, struct vbsf_super_info *sf_g, struct sf_inode_info *sf_i,
     333                                  struct dentry *dentry, SHFLSTRING ** result);
     334extern int  vbsf_nlscpy(struct vbsf_super_info *sf_g, char *name, size_t name_bound_len,
     335                       const unsigned char *utf8_name, size_t utf8_len);
     336extern void vbsf_dir_info_free(struct sf_dir_info *p);
     337extern void vbsf_dir_info_empty(struct sf_dir_info *p);
     338extern struct sf_dir_info *vbsf_dir_info_alloc(void);
     339extern int  vbsf_dir_read_all(struct vbsf_super_info *sf_g, struct sf_inode_info *sf_i,
     340                              struct sf_dir_info *sf_d, SHFLHANDLE handle);
    343341
    344342#if 1
     
    354352#endif
    355353
    356 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) || defined(KERNEL_FC6)
    357 /* FC6 kernel 2.6.18, vanilla kernel 2.6.19+ */
    358 # define GET_INODE_INFO(i)       ((struct sf_inode_info *) (i)->i_private)
    359 # define SET_INODE_INFO(i, sf_i) (i)->i_private = sf_i
    360 #else
    361 /* vanilla kernel up to 2.6.18 */
    362 # define GET_INODE_INFO(i)       ((struct sf_inode_info *) (i)->u.generic_ip)
    363 # define SET_INODE_INFO(i, sf_i) (i)->u.generic_ip = sf_i
    364 #endif
    365 
    366354#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
    367355# define GET_F_DENTRY(f)        (f->f_path.dentry)
Note: See TracChangeset for help on using the changeset viewer.

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