儲存庫 vbox 的更動 77530
- 時間撮記:
- 2019-3-1 下午02:39:03 (6 年 以前)
- svn:sync-xref-src-repo-rev:
- 129133
- 位置:
- trunk/src/VBox/Additions/linux/sharedfolders
- 檔案:
-
- 修改 6 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Additions/linux/sharedfolders/dirops.c
r77529 r77530 39 39 * reading in the whole directory on open. 40 40 */ 41 static 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)41 static int vbsf_dir_open_worker(struct vbsf_super_info *sf_g, struct vbsf_dir_info *sf_d, 42 struct vbsf_inode_info *sf_i, const char *pszCaller) 43 43 { 44 44 int rc; … … 114 114 { 115 115 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb); 116 struct sf_inode_info *sf_i =GET_INODE_INFO(inode);117 struct sf_dir_info *sf_d;116 struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode); 117 struct vbsf_dir_info *sf_d; 118 118 int err; 119 119 … … 210 210 loff_t cur; 211 211 struct vbsf_super_info *sf_g; 212 struct sf_dir_info *sf_d;213 struct sf_inode_info *sf_i;212 struct vbsf_dir_info *sf_d; 213 struct vbsf_inode_info *sf_i; 214 214 struct inode *inode; 215 215 struct list_head *pos, *list; … … 217 217 TRACE(); 218 218 219 inode = GET_F_DENTRY(dir)->d_inode;220 sf_i = GET_INODE_INFO(inode);219 inode = VBSF_GET_F_DENTRY(dir)->d_inode; 220 sf_i = VBSF_GET_INODE_INFO(inode); 221 221 sf_g = VBSF_GET_SUPER_INFO(inode->i_sb); 222 222 sf_d = dir->private_data; … … 242 242 list = &sf_d->info_list; 243 243 list_for_each(pos, list) { 244 struct sf_dir_buf *b;244 struct vbsf_dir_buf *b; 245 245 SHFLDIRINFO *info; 246 246 loff_t i; 247 247 248 b = list_entry(pos, struct sf_dir_buf, head);248 b = list_entry(pos, struct vbsf_dir_buf, head); 249 249 if (dir->f_pos >= cur + b->cEntries) { 250 250 cur += b->cEntries; … … 387 387 * Allocate memory for our additional inode info and create an inode. 388 388 */ 389 struct sf_inode_info *sf_new_i = (structsf_inode_info *)kmalloc(sizeof(*sf_new_i), GFP_KERNEL);389 struct vbsf_inode_info *sf_new_i = (struct vbsf_inode_info *)kmalloc(sizeof(*sf_new_i), GFP_KERNEL); 390 390 if (sf_new_i) { 391 391 ino_t iNodeNo = iunique(parent->i_sb, 1); … … 409 409 sf_new_i->handle = SHFL_HANDLE_NIL; 410 410 411 SET_INODE_INFO(pInode, sf_new_i);411 VBSF_SET_INODE_INFO(pInode, sf_new_i); 412 412 vbsf_init_inode(pInode, sf_new_i, pObjInfo, sf_g); 413 413 … … 448 448 { 449 449 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(parent->i_sb); 450 struct sf_inode_info *sf_i =GET_INODE_INFO(parent);450 struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(parent); 451 451 SHFLSTRING *path; 452 452 struct dentry *dret; … … 535 535 536 536 /** 537 * This should allocate memory for sf_inode_info, compute a unique inode537 * This should allocate memory for vbsf_inode_info, compute a unique inode 538 538 * number, get an inode from vfs, initialize inode info, instantiate 539 539 * dentry. … … 553 553 if (pInode) { 554 554 /* Store this handle if we leave the handle open. */ 555 struct sf_inode_info *sf_new_i =GET_INODE_INFO(pInode);555 struct vbsf_inode_info *sf_new_i = VBSF_GET_INODE_INFO(pInode); 556 556 sf_new_i->handle = handle; 557 557 return 0; … … 572 572 { 573 573 int rc, err; 574 struct sf_inode_info *sf_parent_i =GET_INODE_INFO(parent);574 struct vbsf_inode_info *sf_parent_i = VBSF_GET_INODE_INFO(parent); 575 575 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(parent->i_sb); 576 576 SHFLSTRING *path; … … 724 724 int rc, err; 725 725 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(parent->i_sb); 726 struct sf_inode_info *sf_parent_i =GET_INODE_INFO(parent);726 struct vbsf_inode_info *sf_parent_i = VBSF_GET_INODE_INFO(parent); 727 727 SHFLSTRING *path; 728 728 … … 743 743 744 744 if (dentry->d_inode) { 745 struct sf_inode_info *sf_i =GET_INODE_INFO(dentry->d_inode);745 struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(dentry->d_inode); 746 746 sf_i->force_restat = 1; 747 747 sf_i->force_reread = 1; … … 830 830 err = -EINVAL; 831 831 } else { 832 struct sf_inode_info *sf_old_i =GET_INODE_INFO(old_parent);833 struct sf_inode_info *sf_new_i =GET_INODE_INFO(new_parent);832 struct vbsf_inode_info *sf_old_i = VBSF_GET_INODE_INFO(old_parent); 833 struct vbsf_inode_info *sf_new_i = VBSF_GET_INODE_INFO(new_parent); 834 834 /* As we save the relative path inside the inode structure, we need to change 835 835 this if the rename is successful. */ 836 struct sf_inode_info *sf_file_i =GET_INODE_INFO(old_dentry->d_inode);836 struct vbsf_inode_info *sf_file_i = VBSF_GET_INODE_INFO(old_dentry->d_inode); 837 837 SHFLSTRING *old_path; 838 838 SHFLSTRING *new_path; … … 882 882 int err; 883 883 int rc; 884 struct sf_inode_info *sf_i;884 struct vbsf_inode_info *sf_i; 885 885 struct vbsf_super_info *sf_g; 886 886 SHFLSTRING *path, *ssymname; … … 890 890 TRACE(); 891 891 sf_g = VBSF_GET_SUPER_INFO(parent->i_sb); 892 sf_i = GET_INODE_INFO(parent);892 sf_i = VBSF_GET_INODE_INFO(parent); 893 893 894 894 BUG_ON(!sf_g); -
trunk/src/VBox/Additions/linux/sharedfolders/lnkops.c
r77529 r77530 45 45 struct inode *inode = dentry->d_inode; 46 46 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb); 47 struct sf_inode_info *sf_i =GET_INODE_INFO(inode);47 struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode); 48 48 int error = -ENOMEM; 49 49 char *path = (char *)get_zeroed_page(GFP_KERNEL); … … 52 52 if (path) { 53 53 error = 0; 54 rc = VbglR0SfReadLink(&g_SfClient, &sf_g->map, sf_i->path, 55 PATH_MAX, path); 54 rc = VbglR0SfReadLink(&g_SfClient, &sf_g->map, sf_i->path, PATH_MAX, path); 56 55 if (RT_FAILURE(rc)) { 57 56 LogFunc(("VbglR0SfReadLink failed, caller=%s, rc=%Rrc\n", __func__, rc)); … … 90 89 { 91 90 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb); 92 struct sf_inode_info *sf_i =GET_INODE_INFO(inode);91 struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode); 93 92 char *path; 94 93 int rc; -
trunk/src/VBox/Additions/linux/sharedfolders/regops.c
r77529 r77530 58 58 * @param pInodeInfo The inode which handles to drop. 59 59 */ 60 void vbsf_handle_drop_chain(struct sf_inode_info *pInodeInfo)60 void vbsf_handle_drop_chain(struct vbsf_inode_info *pInodeInfo) 61 61 { 62 62 struct sf_handle *pCur, *pNext; … … 85 85 * @param fFlagsClear The flags that must be clear. 86 86 */ 87 struct sf_handle *vbsf_handle_find(struct sf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear)87 struct sf_handle *vbsf_handle_find(struct vbsf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear) 88 88 { 89 89 struct sf_handle *pCur; … … 163 163 * @param pHandle The handle to add. 164 164 */ 165 void vbsf_handle_append(struct sf_inode_info *pInodeInfo, struct sf_handle *pHandle)165 void vbsf_handle_append(struct vbsf_inode_info *pInodeInfo, struct sf_handle *pHandle) 166 166 { 167 167 #ifdef VBOX_STRICT … … 246 246 }; 247 247 248 static int vbsf_reg_read_aux(const char *caller, struct vbsf_super_info *sf_g, struct sf_reg_info *sf_r,248 static int vbsf_reg_read_aux(const char *caller, struct vbsf_super_info *sf_g, struct vbsf_reg_info *sf_r, 249 249 void *buf, uint32_t *nread, uint64_t pos) 250 250 { … … 266 266 loff_t orig_offset = *poffset; 267 267 loff_t offset = orig_offset; 268 struct inode *inode = GET_F_DENTRY(in)->d_inode;268 struct inode *inode = VBSF_GET_F_DENTRY(in)->d_inode; 269 269 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb); 270 struct sf_reg_info *sf_r = in->private_data;270 struct vbsf_reg_info *sf_r = in->private_data; 271 271 ssize_t retval; 272 272 struct page *kpage = 0; … … 445 445 */ 446 446 static 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)447 struct vbsf_super_info *sf_g, struct vbsf_reg_info *sf_r) 448 448 { 449 449 /* … … 560 560 static ssize_t vbsf_reg_read(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off) 561 561 { 562 struct inode *inode = GET_F_DENTRY(file)->d_inode;562 struct inode *inode = VBSF_GET_F_DENTRY(file)->d_inode; 563 563 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb); 564 struct sf_reg_info *sf_r = file->private_data;564 struct vbsf_reg_info *sf_r = file->private_data; 565 565 struct address_space *mapping = inode->i_mapping; 566 566 … … 684 684 */ 685 685 static 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)686 struct inode *inode, struct vbsf_inode_info *sf_i, 687 struct vbsf_super_info *sf_g, struct vbsf_reg_info *sf_r) 688 688 { 689 689 /* … … 803 803 static ssize_t vbsf_reg_write(struct file *file, const char *buf, size_t size, loff_t * off) 804 804 { 805 struct inode *inode = GET_F_DENTRY(file)->d_inode;806 struct sf_inode_info *sf_i =GET_INODE_INFO(inode);805 struct inode *inode = VBSF_GET_F_DENTRY(file)->d_inode; 806 struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode); 807 807 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb); 808 struct sf_reg_info *sf_r = file->private_data;808 struct vbsf_reg_info *sf_r = file->private_data; 809 809 struct address_space *mapping = inode->i_mapping; 810 810 loff_t pos; … … 936 936 int rc, rc_linux = 0; 937 937 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb); 938 struct sf_inode_info *sf_i =GET_INODE_INFO(inode);939 struct sf_reg_info *sf_r;938 struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode); 939 struct vbsf_reg_info *sf_r; 940 940 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) 941 941 struct dentry *dentry = file_dentry(file); … … 1096 1096 static int vbsf_reg_release(struct inode *inode, struct file *file) 1097 1097 { 1098 struct sf_reg_info *sf_r;1098 struct vbsf_reg_info *sf_r; 1099 1099 struct vbsf_super_info *sf_g; 1100 struct sf_inode_info *sf_i =GET_INODE_INFO(inode);1100 struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode); 1101 1101 1102 1102 SFLOGFLOW(("vbsf_reg_release: inode=%p file=%p\n", inode, file)); … … 1145 1145 #endif 1146 1146 case SEEK_END: { 1147 struct sf_reg_info *sf_r = file->private_data;1148 int rc = vbsf_inode_revalidate_with_handle( GET_F_DENTRY(file), sf_r->Handle.hHost, true /*fForce*/,1147 struct vbsf_reg_info *sf_r = file->private_data; 1148 int rc = vbsf_inode_revalidate_with_handle(VBSF_GET_F_DENTRY(file), sf_r->Handle.hHost, true /*fForce*/, 1149 1149 false /*fInodeLocked*/); 1150 1150 if (rc == 0) … … 1266 1266 static int vbsf_readpage(struct file *file, struct page *page) 1267 1267 { 1268 struct inode *inode = GET_F_DENTRY(file)->d_inode;1268 struct inode *inode = VBSF_GET_F_DENTRY(file)->d_inode; 1269 1269 int err; 1270 1270 … … 1275 1275 if (pReq) { 1276 1276 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb); 1277 struct sf_reg_info *sf_r = file->private_data;1277 struct vbsf_reg_info *sf_r = file->private_data; 1278 1278 uint32_t cbRead; 1279 1279 int vrc; … … 1324 1324 static int vbsf_writepage(struct page *page, struct writeback_control *wbc) 1325 1325 { 1326 struct address_space *mapping= page->mapping;1327 struct inode *inode= mapping->host;1328 struct sf_inode_info *sf_i =GET_INODE_INFO(inode);1329 struct sf_handle *pHandle= vbsf_handle_find(sf_i, SF_HANDLE_F_WRITE, SF_HANDLE_F_APPEND);1330 int err;1326 struct address_space *mapping = page->mapping; 1327 struct inode *inode = mapping->host; 1328 struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(inode); 1329 struct sf_handle *pHandle = vbsf_handle_find(sf_i, SF_HANDLE_F_WRITE, SF_HANDLE_F_APPEND); 1330 int err; 1331 1331 1332 1332 SFLOGFLOW(("vbsf_writepage: inode=%p page=%p off=%#llx pHandle=%p (%#llx)\n", -
trunk/src/VBox/Additions/linux/sharedfolders/utils.c
r77529 r77530 142 142 * Initializes the @a inode attributes based on @a pObjInfo and @a sf_g options. 143 143 */ 144 void vbsf_init_inode(struct inode *inode, struct sf_inode_info *sf_i, PSHFLFSOBJINFO pObjInfo, struct vbsf_super_info *sf_g)144 void vbsf_init_inode(struct inode *inode, struct vbsf_inode_info *sf_i, PSHFLFSOBJINFO pObjInfo, struct vbsf_super_info *sf_g) 145 145 { 146 146 PCSHFLFSOBJATTR pAttr = &pObjInfo->Attr; … … 214 214 * @todo sort out the inode locking situation. 215 215 */ 216 static void vbsf_update_inode(struct inode *pInode, struct sf_inode_info *pInodeInfo, PSHFLFSOBJINFO pObjInfo,216 static void vbsf_update_inode(struct inode *pInode, struct vbsf_inode_info *pInodeInfo, PSHFLFSOBJINFO pObjInfo, 217 217 struct vbsf_super_info *sf_g, bool fInodeLocked) 218 218 { … … 339 339 struct inode *pInode = dentry ? dentry->d_inode : NULL; 340 340 if (pInode) { 341 struct sf_inode_info *sf_i =GET_INODE_INFO(pInode);341 struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(pInode); 342 342 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(pInode->i_sb); 343 343 AssertReturn(sf_i, -EINVAL); … … 448 448 err = -EINVAL; 449 449 } else { 450 struct sf_inode_info *sf_i =GET_INODE_INFO(pInode);450 struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(pInode); 451 451 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(pInode->i_sb); 452 452 AssertReturn(sf_i, -EINVAL); … … 536 536 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) 537 537 if (dentry->d_inode) { 538 struct sf_inode_info *pInodeInfo =GET_INODE_INFO(dentry->d_inode);538 struct vbsf_inode_info *pInodeInfo = VBSF_GET_INODE_INFO(dentry->d_inode); 539 539 if (pInodeInfo) { 540 540 vbsf_time_to_linux(&kstat->btime, &pInodeInfo->BirthTime); … … 575 575 { 576 576 struct vbsf_super_info *sf_g; 577 struct sf_inode_info *sf_i;577 struct vbsf_inode_info *sf_i; 578 578 union SetAttrReqs 579 579 { … … 593 593 594 594 sf_g = VBSF_GET_SUPER_INFO(dentry->d_inode->i_sb); 595 sf_i = GET_INODE_INFO(dentry->d_inode);595 sf_i = VBSF_GET_INODE_INFO(dentry->d_inode); 596 596 cbReq = RT_MAX(sizeof(pReq->Info), sizeof(pReq->Create) + SHFLSTRING_HEADER_SIZE + sf_i->path->u16Size); 597 597 pReq = (union SetAttrReqs *)VbglR0PhysHeapAlloc(cbReq); … … 698 698 #endif /* >= 2.6.0 */ 699 699 700 static int vbsf_make_path(const char *caller, struct sf_inode_info *sf_i,700 static int vbsf_make_path(const char *caller, struct vbsf_inode_info *sf_i, 701 701 const char *d_name, size_t d_len, SHFLSTRING **result) 702 702 { … … 751 751 * [vbsf_make_path] which will allocate SHFLSTRING and fill it in 752 752 */ 753 int vbsf_path_from_dentry(const char *caller, struct vbsf_super_info *sf_g, struct sf_inode_info *sf_i,753 int vbsf_path_from_dentry(const char *caller, struct vbsf_super_info *sf_g, struct vbsf_inode_info *sf_i, 754 754 struct dentry *dentry, SHFLSTRING **result) 755 755 { … … 887 887 } 888 888 889 static struct sf_dir_buf *vbsf_dir_buf_alloc(void)890 { 891 struct sf_dir_buf *b;889 static struct vbsf_dir_buf *vbsf_dir_buf_alloc(void) 890 { 891 struct vbsf_dir_buf *b; 892 892 893 893 TRACE(); … … 911 911 } 912 912 913 static void vbsf_dir_buf_free(struct sf_dir_buf *b)913 static void vbsf_dir_buf_free(struct vbsf_dir_buf *b) 914 914 { 915 915 BUG_ON(!b || !b->buf); … … 924 924 * Free the directory buffer. 925 925 */ 926 void vbsf_dir_info_free(struct sf_dir_info *p)926 void vbsf_dir_info_free(struct vbsf_dir_info *p) 927 927 { 928 928 struct list_head *list, *pos, *tmp; … … 931 931 list = &p->info_list; 932 932 list_for_each_safe(pos, tmp, list) { 933 struct sf_dir_buf *b;934 935 b = list_entry(pos, struct sf_dir_buf, head);933 struct vbsf_dir_buf *b; 934 935 b = list_entry(pos, struct vbsf_dir_buf, head); 936 936 vbsf_dir_buf_free(b); 937 937 } … … 942 942 * Empty (but not free) the directory buffer. 943 943 */ 944 void vbsf_dir_info_empty(struct sf_dir_info *p)944 void vbsf_dir_info_empty(struct vbsf_dir_info *p) 945 945 { 946 946 struct list_head *list, *pos, *tmp; … … 948 948 list = &p->info_list; 949 949 list_for_each_safe(pos, tmp, list) { 950 struct sf_dir_buf *b;951 b = list_entry(pos, struct sf_dir_buf, head);950 struct vbsf_dir_buf *b; 951 b = list_entry(pos, struct vbsf_dir_buf, head); 952 952 b->cEntries = 0; 953 953 b->cbUsed = 0; … … 959 959 * Create a new directory buffer descriptor. 960 960 */ 961 struct sf_dir_info *vbsf_dir_info_alloc(void)962 { 963 struct sf_dir_info *p;961 struct vbsf_dir_info *vbsf_dir_info_alloc(void) 962 { 963 struct vbsf_dir_info *p; 964 964 965 965 TRACE(); … … 977 977 * Search for an empty directory content buffer. 978 978 */ 979 static struct sf_dir_buf *vbsf_get_empty_dir_buf(structsf_dir_info *sf_d)979 static struct vbsf_dir_buf *vbsf_get_empty_dir_buf(struct vbsf_dir_info *sf_d) 980 980 { 981 981 struct list_head *list, *pos; … … 983 983 list = &sf_d->info_list; 984 984 list_for_each(pos, list) { 985 struct sf_dir_buf *b;986 987 b = list_entry(pos, struct sf_dir_buf, head);985 struct vbsf_dir_buf *b; 986 987 b = list_entry(pos, struct vbsf_dir_buf, head); 988 988 if (!b) 989 989 return NULL; … … 999 999 /** @todo r=bird: Why on earth do we read in the entire directory??? This 1000 1000 * cannot be healthy for like big directory and such... */ 1001 int vbsf_dir_read_all(struct vbsf_super_info *sf_g, struct sf_inode_info *sf_i, structsf_dir_info *sf_d, SHFLHANDLE handle)1001 int vbsf_dir_read_all(struct vbsf_super_info *sf_g, struct vbsf_inode_info *sf_i, struct vbsf_dir_info *sf_d, SHFLHANDLE handle) 1002 1002 { 1003 1003 int err; … … 1015 1015 for (;;) { 1016 1016 int rc; 1017 struct sf_dir_buf *b;1017 struct vbsf_dir_buf *b; 1018 1018 1019 1019 b = vbsf_get_empty_dir_buf(sf_d); … … 1074 1074 1075 1075 Assert(dentry); 1076 SFLOGFLOW(("vbsf_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, 1077 dentry->d_inode ? VBSF_GET_INODE_INFO(dentry->d_inode)->path->String.ach : "<negative>")); 1077 1078 1078 1079 /* … … 1104 1105 * and ignore the dentry timestamp for positive entries. 1105 1106 */ 1106 //struct sf_inode_info *sf_i =GET_INODE_INFO(pInode);1107 //struct vbsf_inode_info *sf_i = VBSF_GET_INODE_INFO(pInode); 1107 1108 unsigned long const cJiffiesAge = vbsf_dentry_get_update_jiffies(dentry) - jiffies; 1108 1109 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(dentry->d_sb); -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c
r77529 r77530 61 61 uint32_t g_fHostFeatures = 0; 62 62 63 /** Protects all the sf_inode_info::HandleList lists. */63 /** Protects all the vbsf_inode_info::HandleList lists. */ 64 64 spinlock_t g_SfHandleLock; 65 65 … … 344 344 struct dentry *droot; 345 345 struct inode *iroot; 346 struct sf_inode_info *sf_i;346 struct vbsf_inode_info *sf_i; 347 347 struct vbsf_super_info *sf_g; 348 348 SHFLFSOBJINFO fsinfo; … … 436 436 437 437 vbsf_init_inode(iroot, sf_i, &fsinfo, sf_g); 438 SET_INODE_INFO(iroot, sf_i);438 VBSF_SET_INODE_INFO(iroot, sf_i); 439 439 440 440 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25) … … 492 492 #endif 493 493 { 494 struct sf_inode_info *sf_i;494 struct vbsf_inode_info *sf_i; 495 495 496 496 TRACE(); … … 510 510 * Clean up our inode info. 511 511 */ 512 sf_i = GET_INODE_INFO(inode);512 sf_i = VBSF_GET_INODE_INFO(inode); 513 513 if (sf_i) { 514 SET_INODE_INFO(inode, NULL);514 VBSF_SET_INODE_INFO(inode, NULL); 515 515 516 516 Assert(sf_i->u32Magic == SF_INODE_INFO_MAGIC); … … 605 605 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 23) 606 606 struct vbsf_super_info *sf_g; 607 struct sf_inode_info *sf_i;607 struct vbsf_inode_info *sf_i; 608 608 struct inode *iroot; 609 609 SHFLFSOBJINFO fsinfo; … … 626 626 return -ENOSYS; 627 627 628 sf_i = GET_INODE_INFO(iroot);628 sf_i = VBSF_GET_INODE_INFO(iroot); 629 629 err = vbsf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0); 630 630 BUG_ON(err != 0); -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h
r77529 r77530 83 83 84 84 85 #define DIR_BUFFER_SIZE (16*_1K) 85 /* global variables */ 86 extern VBGLSFCLIENT g_SfClient; 87 extern spinlock_t g_SfHandleLock; 88 89 extern struct inode_operations vbsf_dir_iops; 90 extern struct inode_operations vbsf_lnk_iops; 91 extern struct inode_operations vbsf_reg_iops; 92 extern struct file_operations vbsf_dir_fops; 93 extern struct file_operations vbsf_reg_fops; 94 extern struct dentry_operations vbsf_dentry_ops; 95 extern struct address_space_operations vbsf_reg_aops; 96 86 97 87 98 /** … … 131 142 */ 132 143 struct sf_handle { 133 /** List entry (head sf_inode_info::HandleList). */144 /** List entry (head vbsf_inode_info::HandleList). */ 134 145 RTLISTNODE Entry; 135 146 /** Host file/whatever handle. */ … … 142 153 #ifdef VBOX_STRICT 143 154 /** For strictness checks. */ 144 struct sf_inode_info *pInodeInfo;155 struct vbsf_inode_info *pInodeInfo; 145 156 #endif 146 157 }; … … 158 169 /** @} */ 159 170 171 extern void vbsf_handle_drop_chain(struct vbsf_inode_info *pInodeInfo); 172 extern struct sf_handle *vbsf_handle_find(struct vbsf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear); 173 extern uint32_t vbsf_handle_release_slow(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller); 174 extern void vbsf_handle_append(struct vbsf_inode_info *pInodeInfo, struct sf_handle *pHandle); 175 176 /** 177 * Releases a handle. 178 * 179 * @returns New reference count. 180 * @param pHandle The handle to release. 181 * @param sf_g The info structure for the shared folder associated 182 * with the handle. 183 * @param pszCaller The caller name (for logging failures). 184 */ 185 DECLINLINE(uint32_t) vbsf_handle_release(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller) 186 { 187 uint32_t cRefs; 188 189 Assert((pHandle->fFlags & SF_HANDLE_F_MAGIC_MASK) == SF_HANDLE_F_MAGIC); 190 Assert(pHandle->pInodeInfo); 191 Assert(pHandle->pInodeInfo && pHandle->pInodeInfo->u32Magic == SF_INODE_INFO_MAGIC); 192 193 cRefs = ASMAtomicDecU32(&pHandle->cRefs); 194 Assert(cRefs < _64M); 195 if (cRefs) 196 return cRefs; 197 return vbsf_handle_release_slow(pHandle, sf_g, pszCaller); 198 } 199 200 160 201 /** 161 202 * VBox specific per-inode information. 162 203 */ 163 struct sf_inode_info {204 struct vbsf_inode_info { 164 205 /** Which file */ 165 206 SHFLSTRING *path; … … 189 230 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) || defined(KERNEL_FC6) 190 231 /* FC6 kernel 2.6.18, vanilla kernel 2.6.19+ */ 191 # define GET_INODE_INFO(i) ((structsf_inode_info *) (i)->i_private)192 # define SET_INODE_INFO(i, sf_i) (i)->i_private = sf_i232 # define VBSF_GET_INODE_INFO(i) ((struct vbsf_inode_info *) (i)->i_private) 233 # define VBSF_SET_INODE_INFO(i, sf_i) (i)->i_private = sf_i 193 234 #else 194 235 /* 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 199 struct sf_dir_info { 200 /** @todo sf_handle. */ 201 struct list_head info_list; 202 }; 203 204 struct sf_dir_buf { 205 size_t cEntries; 206 size_t cbFree; 207 size_t cbUsed; 208 void *buf; 209 struct list_head head; 210 }; 211 212 /** 213 * VBox specific information for a regular file. 214 */ 215 struct sf_reg_info { 216 /** Handle tracking structure. */ 217 struct sf_handle Handle; 218 }; 219 220 /** 221 * Sets the update-jiffies value for a dentry. 222 * 223 * This is used together with vbsf_super_info::ttl to reduce re-validation of 224 * dentry structures while walking. 225 * 226 * This used to be living in d_time, but since 4.9.0 that seems to have become 227 * unfashionable and d_fsdata is now used to for this purpose. We do this all 228 * the way back, since d_time seems only to have been used by the file system 229 * specific code (at least going back to 2.4.0). 230 */ 231 DECLINLINE(void) vbsf_dentry_set_update_jiffies(struct dentry *pDirEntry, unsigned long uToSet) 232 { 233 pDirEntry->d_fsdata = (void *)uToSet; 234 } 235 236 /** 237 * Get the update-jiffies value for a dentry. 238 */ 239 DECLINLINE(unsigned long) vbsf_dentry_get_update_jiffies(struct dentry *pDirEntry) 240 { 241 return (unsigned long)pDirEntry->d_fsdata; 242 } 243 244 /** 245 * Increase the time-to-live of @a pDirEntry and all ancestors. 246 * @param pDirEntry The directory entry cache entry which ancestors 247 * we should increase the TTL for. 248 */ 249 DECLINLINE(void) vbsf_dentry_chain_increase_ttl(struct dentry *pDirEntry) 250 { 251 #ifdef VBOX_STRICT 252 struct super_block * const pSuper = pDirEntry->d_sb; 253 #endif 254 unsigned long const uToSet = jiffies; 255 do { 256 Assert(pDirEntry->d_sb == pSuper); 257 vbsf_dentry_set_update_jiffies(pDirEntry, uToSet); 258 pDirEntry = pDirEntry->d_parent; 259 } while (!IS_ROOT(pDirEntry)); 260 } 261 262 /** 263 * Increase the time-to-live of all ancestors. 264 * @param pDirEntry The directory entry cache entry which ancestors 265 * we should increase the TTL for. 266 */ 267 DECLINLINE(void) vbsf_dentry_chain_increase_parent_ttl(struct dentry *pDirEntry) 268 { 269 Assert(!pDirEntry->d_parent || pDirEntry->d_parent->d_sb == pDirEntry->d_sb); 270 pDirEntry = pDirEntry->d_parent; 271 if (pDirEntry) 272 vbsf_dentry_chain_increase_ttl(pDirEntry); 273 } 274 275 276 /* globals */ 277 extern VBGLSFCLIENT g_SfClient; 278 extern spinlock_t g_SfHandleLock; 279 280 281 /* forward declarations */ 282 extern struct inode_operations vbsf_dir_iops; 283 extern struct inode_operations vbsf_lnk_iops; 284 extern struct inode_operations vbsf_reg_iops; 285 extern struct file_operations vbsf_dir_fops; 286 extern struct file_operations vbsf_reg_fops; 287 extern struct dentry_operations vbsf_dentry_ops; 288 extern struct address_space_operations vbsf_reg_aops; 289 290 extern void vbsf_handle_drop_chain(struct sf_inode_info *pInodeInfo); 291 extern struct sf_handle *vbsf_handle_find(struct sf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear); 292 extern uint32_t vbsf_handle_release_slow(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller); 293 extern void vbsf_handle_append(struct sf_inode_info *pInodeInfo, struct sf_handle *pHandle); 294 295 /** 296 * Releases a handle. 297 * 298 * @returns New reference count. 299 * @param pHandle The handle to release. 300 * @param sf_g The info structure for the shared folder associated 301 * with the handle. 302 * @param pszCaller The caller name (for logging failures). 303 */ 304 DECLINLINE(uint32_t) vbsf_handle_release(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller) 305 { 306 uint32_t cRefs; 307 308 Assert((pHandle->fFlags & SF_HANDLE_F_MAGIC_MASK) == SF_HANDLE_F_MAGIC); 309 Assert(pHandle->pInodeInfo); 310 Assert(pHandle->pInodeInfo && pHandle->pInodeInfo->u32Magic == SF_INODE_INFO_MAGIC); 311 312 cRefs = ASMAtomicDecU32(&pHandle->cRefs); 313 Assert(cRefs < _64M); 314 if (cRefs) 315 return cRefs; 316 return vbsf_handle_release_slow(pHandle, sf_g, pszCaller); 317 } 318 319 extern void vbsf_init_inode(struct inode *inode, struct sf_inode_info *sf_i, PSHFLFSOBJINFO info, struct vbsf_super_info *sf_g); 320 extern int vbsf_stat(const char *caller, struct vbsf_super_info *sf_g, SHFLSTRING * path, PSHFLFSOBJINFO result, int ok_to_fail); 236 # define VBSF_GET_INODE_INFO(i) ((struct vbsf_inode_info *) (i)->u.generic_ip) 237 # define VBSF_SET_INODE_INFO(i, sf_i) (i)->u.generic_ip = sf_i 238 #endif 239 240 extern void vbsf_init_inode(struct inode *inode, struct vbsf_inode_info *sf_i, PSHFLFSOBJINFO info, struct vbsf_super_info *sf_g); 321 241 extern int vbsf_inode_revalidate(struct dentry *dentry); 322 242 extern int vbsf_inode_revalidate_worker(struct dentry *dentry, bool fForced); … … 330 250 extern int vbsf_inode_setattr(struct dentry *dentry, struct iattr *iattr); 331 251 #endif 332 extern int vbsf_path_from_dentry(const char *caller, struct vbsf_super_info *sf_g, struct sf_inode_info *sf_i, 252 253 254 /** 255 * VBox specific information for a regular file. 256 */ 257 struct vbsf_reg_info { 258 /** Handle tracking structure. */ 259 struct sf_handle Handle; 260 }; 261 262 263 struct vbsf_dir_info { 264 /** @todo sf_handle. */ 265 struct list_head info_list; 266 }; 267 268 #define DIR_BUFFER_SIZE (16*_1K) 269 struct vbsf_dir_buf { 270 size_t cEntries; 271 size_t cbFree; 272 size_t cbUsed; 273 void *buf; 274 struct list_head head; 275 }; 276 277 extern void vbsf_dir_info_free(struct vbsf_dir_info *p); 278 extern void vbsf_dir_info_empty(struct vbsf_dir_info *p); 279 extern struct vbsf_dir_info *vbsf_dir_info_alloc(void); 280 extern int vbsf_dir_read_all(struct vbsf_super_info *sf_g, struct vbsf_inode_info *sf_i, 281 struct vbsf_dir_info *sf_d, SHFLHANDLE handle); 282 283 284 /** 285 * Sets the update-jiffies value for a dentry. 286 * 287 * This is used together with vbsf_super_info::ttl to reduce re-validation of 288 * dentry structures while walking. 289 * 290 * This used to be living in d_time, but since 4.9.0 that seems to have become 291 * unfashionable and d_fsdata is now used to for this purpose. We do this all 292 * the way back, since d_time seems only to have been used by the file system 293 * specific code (at least going back to 2.4.0). 294 */ 295 DECLINLINE(void) vbsf_dentry_set_update_jiffies(struct dentry *pDirEntry, unsigned long uToSet) 296 { 297 pDirEntry->d_fsdata = (void *)uToSet; 298 } 299 300 /** 301 * Get the update-jiffies value for a dentry. 302 */ 303 DECLINLINE(unsigned long) vbsf_dentry_get_update_jiffies(struct dentry *pDirEntry) 304 { 305 return (unsigned long)pDirEntry->d_fsdata; 306 } 307 308 /** 309 * Increase the time-to-live of @a pDirEntry and all ancestors. 310 * @param pDirEntry The directory entry cache entry which ancestors 311 * we should increase the TTL for. 312 */ 313 DECLINLINE(void) vbsf_dentry_chain_increase_ttl(struct dentry *pDirEntry) 314 { 315 #ifdef VBOX_STRICT 316 struct super_block * const pSuper = pDirEntry->d_sb; 317 #endif 318 unsigned long const uToSet = jiffies; 319 do { 320 Assert(pDirEntry->d_sb == pSuper); 321 vbsf_dentry_set_update_jiffies(pDirEntry, uToSet); 322 pDirEntry = pDirEntry->d_parent; 323 } while (!IS_ROOT(pDirEntry)); 324 } 325 326 /** 327 * Increase the time-to-live of all ancestors. 328 * @param pDirEntry The directory entry cache entry which ancestors 329 * we should increase the TTL for. 330 */ 331 DECLINLINE(void) vbsf_dentry_chain_increase_parent_ttl(struct dentry *pDirEntry) 332 { 333 Assert(!pDirEntry->d_parent || pDirEntry->d_parent->d_sb == pDirEntry->d_sb); 334 pDirEntry = pDirEntry->d_parent; 335 if (pDirEntry) 336 vbsf_dentry_chain_increase_ttl(pDirEntry); 337 } 338 339 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) 340 # define VBSF_GET_F_DENTRY(f) (f->f_path.dentry) 341 #else 342 # define VBSF_GET_F_DENTRY(f) (f->f_dentry) 343 #endif 344 345 346 extern int vbsf_stat(const char *caller, struct vbsf_super_info *sf_g, SHFLSTRING * path, PSHFLFSOBJINFO result, int ok_to_fail); 347 extern int vbsf_path_from_dentry(const char *caller, struct vbsf_super_info *sf_g, struct vbsf_inode_info *sf_i, 333 348 struct dentry *dentry, SHFLSTRING ** result); 334 349 extern int vbsf_nlscpy(struct vbsf_super_info *sf_g, char *name, size_t name_bound_len, 335 350 const unsigned char *utf8_name, size_t utf8_len); 336 extern void vbsf_dir_info_free(struct sf_dir_info *p); 337 extern void vbsf_dir_info_empty(struct sf_dir_info *p); 338 extern struct sf_dir_info *vbsf_dir_info_alloc(void); 339 extern 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); 351 341 352 342 353 #if 1 … … 352 363 #endif 353 364 354 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)355 # define GET_F_DENTRY(f) (f->f_path.dentry)356 #else357 # define GET_F_DENTRY(f) (f->f_dentry)358 #endif359 360 365 #endif /* !GA_INCLUDED_SRC_linux_sharedfolders_vfsmod_h */
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器