- 時間撮記:
- 2016-1-19 上午11:36:14 (9 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Additions/linux/sharedfolders/lnkops.c
r58195 r59406 21 21 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 22 22 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) 24 25 static const char *sf_follow_link(struct dentry *dentry, void **cookie) 25 # else26 # else 26 27 static void *sf_follow_link(struct dentry *dentry, struct nameidata *nd) 27 # endif28 # endif 28 29 { 29 30 struct inode *inode = dentry->d_inode; … … 45 46 } 46 47 } 47 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)48 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) 48 49 return error ? ERR_PTR(error) : (*cookie = path); 49 # else50 # else 50 51 nd_set_link(nd, error ? ERR_PTR(error) : path); 51 52 return NULL; 52 # endif53 # endif 53 54 } 54 55 55 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)56 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) 56 57 static void sf_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) 57 58 { … … 60 61 free_page((unsigned long)page); 61 62 } 62 #endif 63 # endif 64 65 # else /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) */ 66 static 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) */ 63 90 64 91 struct inode_operations sf_lnk_iops = 65 92 { 66 93 .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) 67 97 .follow_link = sf_follow_link, 68 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)69 98 .put_link = free_page_put_link, 70 99 # else 100 .follow_link = sf_follow_link, 71 101 .put_link = sf_put_link 72 102 # endif 73 103 }; 74 104 75 #endif 105 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) */
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器