VirtualBox

忽略:
時間撮記:
2016-1-19 上午11:36:14 (9 年 以前)
作者:
vboxsync
訊息:

Additions/linux/sharedfolders: Linux 4.5 fix, untested

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Additions/linux/sharedfolders/lnkops.c

    r58195 r59406  
    2121#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    2222
    23 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
     23# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
     24#  if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
    2425static const char *sf_follow_link(struct dentry *dentry, void **cookie)
    25 # else
     26#  else
    2627static void *sf_follow_link(struct dentry *dentry, struct nameidata *nd)
    27 # endif
     28#  endif
    2829{
    2930    struct inode *inode = dentry->d_inode;
     
    4546        }
    4647    }
    47 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
     48#  if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
    4849    return error ? ERR_PTR(error) : (*cookie = path);
    49 # else
     50#  else
    5051    nd_set_link(nd, error ? ERR_PTR(error) : path);
    5152    return NULL;
    52 # endif
     53#  endif
    5354}
    5455
    55 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
     56#  if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
    5657static void sf_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
    5758{
     
    6061        free_page((unsigned long)page);
    6162}
    62 #endif
     63#  endif
     64
     65# else /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) */
     66static const char *sf_get_link(struct dentry *dentry, struct inode *inode,
     67                               struct delayed_call *done)
     68{
     69    struct sf_glob_info *sf_g = GET_GLOB_INFO(inode->i_sb);
     70    struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
     71    char *path;
     72    int rc;
     73
     74    if (!dentry)
     75        return ERR_PTR(-ECHILD);
     76    path = kzalloc(PAGE_SIZE, GFP_KERNEL);
     77    if (!path)
     78        return ERR_PTR(-ENOMEM);
     79    rc = VbglR0SfReadLink(&client_handle, &sf_g->map, sf_i->path, PATH_MAX, path);
     80    if (RT_FAILURE(rc))
     81    {
     82        LogFunc(("VbglR0SfReadLink failed, caller=%s, rc=%Rrc\n", __func__, rc));
     83        kfree(path);
     84        return ERR_PTR(-EPROTO);
     85    }
     86    set_delayed_call(done, kfree_link, path);
     87    return path;
     88}
     89# endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) */
    6390
    6491struct inode_operations sf_lnk_iops =
    6592{
    6693    .readlink       = generic_readlink,
     94# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
     95    .get_link       = sf_get_link
     96# elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
    6797    .follow_link    = sf_follow_link,
    68 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
    6998    .put_link       = free_page_put_link,
    7099# else
     100    .follow_link    = sf_follow_link,
    71101    .put_link       = sf_put_link
    72102# endif
    73103};
    74104
    75 #endif
     105#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) */
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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