Changeset 77529 in vbox for trunk/src/VBox/Additions/linux
- Timestamp:
- Mar 1, 2019 2:13:40 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 129132
- Location:
- trunk/src/VBox/Additions/linux/sharedfolders
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/dirops.c
r77526 r77529 39 39 * reading in the whole directory on open. 40 40 */ 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)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) 43 43 { 44 44 int rc; … … 84 84 /** @todo Reading all entries upon opening the directory doesn't seem like 85 85 * 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); 88 88 } else 89 89 err = -ENOENT; … … 111 111 * @returns 0 on success, Linux error code otherwise 112 112 */ 113 static int sf_dir_open(struct inode *inode, struct file *file)113 static int vbsf_dir_open(struct inode *inode, struct file *file) 114 114 { 115 115 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb); … … 127 127 } 128 128 129 sf_d = sf_dir_info_alloc();129 sf_d = vbsf_dir_info_alloc(); 130 130 if (!sf_d) { 131 131 LogRelFunc(("could not allocate directory info for '%s'\n", sf_i->path->String.ach)); … … 133 133 } 134 134 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"); 136 136 if (!err) 137 137 file->private_data = sf_d; 138 138 else 139 sf_dir_info_free(sf_d);139 vbsf_dir_info_free(sf_d); 140 140 141 141 return err; … … 151 151 * returns 0 on success, Linux error code otherwise 152 152 */ 153 static int sf_dir_release(struct inode *inode, struct file *file)153 static int vbsf_dir_release(struct inode *inode, struct file *file) 154 154 { 155 155 TRACE(); 156 156 157 157 if (file->private_data) 158 sf_dir_info_free(file->private_data);158 vbsf_dir_info_free(file->private_data); 159 159 160 160 return 0; … … 166 166 * returns d_type 167 167 */ 168 static int sf_get_d_type(RTFMODE fMode)168 static int vbsf_get_d_type(RTFMODE fMode) 169 169 { 170 170 int d_type; … … 206 206 * @returns 0 for success, 1 for end reached, Linux error code otherwise. 207 207 */ 208 static int sf_getdent(struct file *dir, char d_name[NAME_MAX], int *d_type)208 static int vbsf_getdent(struct file *dir, char d_name[NAME_MAX], int *d_type) 209 209 { 210 210 loff_t cur; … … 227 227 228 228 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"); 230 230 if (!err) { 231 231 sf_i->force_reread = 0; 232 232 } else { 233 233 if (err == -ENOENT) { 234 sf_dir_info_free(sf_d);234 vbsf_dir_info_free(sf_d); 235 235 dir->private_data = NULL; 236 236 } … … 260 260 } 261 261 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, 265 265 info->name.String.utf8, info->name.u16Length); 266 266 } … … 274 274 * [filldir]. [filldir] magically modifies it's argument - [opaque] 275 275 * and takes following additional arguments (which i in turn get from 276 * the host via sf_getdent):276 * the host via vbsf_getdent): 277 277 * 278 278 * name : name of the entry (i must also supply it's length huh?) … … 288 288 * along the way) and feed them to [filldir] until: 289 289 * 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) 291 291 * b. failure to compute fake inode number 292 292 * c. filldir returns an error (see comment on that) 293 293 */ 294 294 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) 295 static int sf_dir_iterate(struct file *dir, struct dir_context *ctx)295 static int vbsf_dir_iterate(struct file *dir, struct dir_context *ctx) 296 296 #else 297 static int sf_dir_read(struct file *dir, void *opaque, filldir_t filldir)297 static int vbsf_dir_read(struct file *dir, void *opaque, filldir_t filldir) 298 298 #endif 299 299 { … … 306 306 int d_type = DT_UNKNOWN; 307 307 308 err = sf_getdent(dir, d_name, &d_type);308 err = vbsf_getdent(dir, d_name, &d_type); 309 309 switch (err) { 310 310 case 1: … … 317 317 default: 318 318 /* skip erroneous entry and proceed */ 319 LogFunc((" sf_getdent error %d\n", err));319 LogFunc(("vbsf_getdent error %d\n", err)); 320 320 dir->f_pos += 1; 321 321 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) … … 362 362 } 363 363 364 struct file_operations sf_dir_fops = {365 .open = sf_dir_open,364 struct file_operations vbsf_dir_fops = { 365 .open = vbsf_dir_open, 366 366 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) 367 .iterate = sf_dir_iterate,367 .iterate = vbsf_dir_iterate, 368 368 #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, 372 372 .read = generic_read_dir 373 373 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) … … 379 379 380 380 /** 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 */ 383 static struct inode *vbsf_create_inode(struct inode *parent, struct dentry *dentry, PSHFLSTRING path, 384 PSHFLFSOBJINFO pObjInfo, struct vbsf_super_info *sf_g, bool fInstantiate) 385 385 { 386 386 /* … … 410 410 411 411 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); 413 413 414 414 /* … … 439 439 * returned in case of success and "negative" pointer on error 440 440 */ 441 static struct dentry * sf_lookup(struct inode *parent, struct dentry *dentry441 static struct dentry *vbsf_inode_lookup(struct inode *parent, struct dentry *dentry 442 442 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) 443 , unsigned int flags443 , unsigned int flags 444 444 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 445 , struct nameidata *nd446 #endif 447 )445 , struct nameidata *nd 446 #endif 447 ) 448 448 { 449 449 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(parent->i_sb); … … 454 454 455 455 #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)); 457 457 #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)); 459 459 #else 460 SFLOGFLOW((" sf_lookup: parent=%p dentry=%p\n", parent, dentry));460 SFLOGFLOW(("vbsf_inode_lookup: parent=%p dentry=%p\n", parent, dentry)); 461 461 #endif 462 462 … … 467 467 * Build the path. We'll associate the path with dret's inode on success. 468 468 */ 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); 470 470 if (rc == 0) { 471 471 /* … … 489 489 * the existence of all parent dentries, we increase their TTL. 490 490 */ 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*/); 492 492 if (rc == 0) { 493 493 path = NULL; /* given to the inode */ … … 495 495 } else 496 496 dret = (struct dentry *)ERR_PTR(-ENOMEM); 497 sf_dentry_chain_increase_parent_ttl(dentry);497 vbsf_dentry_chain_increase_parent_ttl(dentry); 498 498 } else if ( pReq->CreateParms.Result == SHFL_FILE_NOT_FOUND 499 499 || pReq->CreateParms.Result == SHFL_PATH_NOT_FOUND /*this probably should happen*/) { … … 516 516 */ 517 517 if (dret == dentry) { 518 sf_dentry_set_update_jiffies(dentry, jiffies);518 vbsf_dentry_set_update_jiffies(dentry, jiffies); 519 519 #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) */ 521 521 #else 522 dentry->d_op = & sf_dentry_ops;522 dentry->d_op = &vbsf_dentry_ops; 523 523 #endif 524 524 d_add(dentry, pInode); … … 546 546 * @returns 0 on success, Linux error code otherwise 547 547 */ 548 static int sf_instantiate(struct inode *parent, struct dentry *dentry, PSHFLSTRING path, PSHFLFSOBJINFO info, SHFLHANDLE handle) 548 static int vbsf_inode_instantiate(struct inode *parent, struct dentry *dentry, PSHFLSTRING path, 549 PSHFLFSOBJINFO info, SHFLHANDLE handle) 549 550 { 550 551 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*/); 552 553 if (pInode) { 553 554 /* Store this handle if we leave the handle open. */ … … 568 569 * @returns 0 on success, Linux error code otherwise 569 570 */ 570 static int sf_create_aux(struct inode *parent, struct dentry *dentry, umode_t mode, int fDirectory)571 static int vbsf_create_worker(struct inode *parent, struct dentry *dentry, umode_t mode, int fDirectory) 571 572 { 572 573 int rc, err; … … 585 586 BUG_ON(!sf_g); 586 587 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); 588 589 if (err) 589 590 goto fail0; 590 591 591 /** @todo combine with sf_path_from_dentry? */592 /** @todo combine with vbsf_path_from_dentry? */ 592 593 pReq = (union CreateAuxReq *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath.String) + path->u16Size); 593 594 if (pReq) { … … 629 630 } 630 631 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, 634 635 fDirectory ? SHFL_HANDLE_NIL : pCreateParms->Handle); 635 636 if (err) { … … 640 641 /* 641 642 * 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(). Save643 * opened with vbsf_reg_open() and later closed with sf_reg_close(). Save 643 644 * the handle in between. Does not apply to directories. True? 644 645 */ … … 677 678 */ 678 679 #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)680 static int vbsf_inode_create(struct inode *parent, struct dentry *dentry, umode_t mode, bool excl) 680 681 #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)682 static int vbsf_inode_create(struct inode *parent, struct dentry *dentry, umode_t mode, struct nameidata *nd) 682 683 #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)684 static int vbsf_inode_create(struct inode *parent, struct dentry *dentry, int mode, struct nameidata *nd) 684 685 #else 685 static int sf_create(struct inode *parent, struct dentry *dentry, int mode)686 static int vbsf_inode_create(struct inode *parent, struct dentry *dentry, int mode) 686 687 #endif 687 688 { … … 690 691 * changed (investigate)... */ 691 692 TRACE(); 692 return sf_create_aux(parent, dentry, mode, 0 /*fDirectory*/);693 return vbsf_create_worker(parent, dentry, mode, 0 /*fDirectory*/); 693 694 } 694 695 … … 702 703 */ 703 704 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) 704 static int sf_mkdir(struct inode *parent, struct dentry *dentry, umode_t mode)705 static int vbsf_inode_mkdir(struct inode *parent, struct dentry *dentry, umode_t mode) 705 706 #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*/);707 static 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*/); 711 712 } 712 713 … … 719 720 * @returns 0 on success, Linux error code otherwise 720 721 */ 721 static int sf_unlink_aux(struct inode *parent, struct dentry *dentry, int fDirectory)722 static int vbsf_unlink_worker(struct inode *parent, struct dentry *dentry, int fDirectory) 722 723 { 723 724 int rc, err; … … 729 730 BUG_ON(!sf_g); 730 731 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); 732 733 if (!err) { 733 734 VBOXSFREMOVEREQ *pReq = (VBOXSFREMOVEREQ *)VbglR0PhysHeapAlloc(RT_UOFFSETOF(VBOXSFREMOVEREQ, StrPath.String) … … 777 778 * @returns 0 on success, Linux error code otherwise 778 779 */ 779 static int sf_unlink(struct inode *parent, struct dentry *dentry)780 { 781 TRACE(); 782 return sf_unlink_aux(parent, dentry, 0/*fDirectory*/);780 static int vbsf_inode_unlink(struct inode *parent, struct dentry *dentry) 781 { 782 TRACE(); 783 return vbsf_unlink_worker(parent, dentry, false /*fDirectory*/); 783 784 } 784 785 … … 790 791 * @returns 0 on success, Linux error code otherwise 791 792 */ 792 static int sf_rmdir(struct inode *parent, struct dentry *dentry)793 { 794 TRACE(); 795 return sf_unlink_aux(parent, dentry, 1/*fDirectory*/);793 static int vbsf_inode_rmdir(struct inode *parent, struct dentry *dentry) 794 { 795 TRACE(); 796 return vbsf_unlink_worker(parent, dentry, true /*fDirectory*/); 796 797 } 797 798 … … 806 807 * @returns 0 on success, Linux error code otherwise 807 808 */ 808 static int sf_rename(struct inode *old_parent, struct dentry *old_dentry,809 struct inode *new_parent, struct dentry *new_dentry809 static int vbsf_inode_rename(struct inode *old_parent, struct dentry *old_dentry, 810 struct inode *new_parent, struct dentry *new_dentry 810 811 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) 811 , unsigned flags812 #endif 813 )812 , unsigned flags 813 #endif 814 ) 814 815 { 815 816 int err = 0, rc = VINF_SUCCESS; … … 842 843 843 844 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); 846 846 if (err) 847 847 LogFunc(("failed to create new path\n")); 848 848 else { 849 849 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); 853 852 if (pReq) { 854 853 memcpy(&pReq->StrDstPath, new_path, SHFLSTRING_HEADER_SIZE + new_path->u16Size); 855 854 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_DIR858 : 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); 859 858 VbglR0PhysHeapFree(pReq); 860 859 } else … … 867 866 /* Set the new relative path in the inode. */ 868 867 sf_file_i->path = new_path; 869 870 868 } else { 871 869 LogFunc(("VbglR0SfRename failed rc=%Rrc\n", … … 880 878 881 879 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 882 static int sf_symlink(struct inode *parent, struct dentry *dentry, const char *symname)880 static int vbsf_ino_symlink(struct inode *parent, struct dentry *dentry, const char *symname) 883 881 { 884 882 int err; … … 897 895 BUG_ON(!sf_i); 898 896 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); 900 898 if (err) 901 899 goto fail0; 902 900 903 ssymname = 904 kmalloc(offsetof(SHFLSTRING, String.utf8) + symname_len, 905 GFP_KERNEL); 901 ssymname = kmalloc(offsetof(SHFLSTRING, String.utf8) + symname_len, GFP_KERNEL); 906 902 if (!ssymname) { 907 903 LogRelFunc(("kmalloc failed, caller=sf_symlink\n")); … … 914 910 memcpy(ssymname->String.utf8, symname, symname_len); 915 911 916 rc = VbglR0SfSymlink(& client_handle, &sf_g->map, path, ssymname, &info);912 rc = VbglR0SfSymlink(&g_SfClient, &sf_g->map, path, ssymname, &info); 917 913 kfree(ssymname); 918 914 … … 922 918 goto fail1; 923 919 } 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)); 926 921 err = -EPROTO; 927 922 goto fail1; 928 923 } 929 924 930 err = sf_instantiate(parent, dentry, path, &info, SHFL_HANDLE_NIL);925 err = vbsf_inode_instantiate(parent, dentry, path, &info, SHFL_HANDLE_NIL); 931 926 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)); 934 928 goto fail1; 935 929 } … … 945 939 #endif /* LINUX_VERSION_CODE >= 2.6.0 */ 946 940 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,941 struct 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, 954 948 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) 955 .revalidate = sf_inode_revalidate949 .revalidate = vbsf_inode_revalidate 956 950 #else 957 .getattr = sf_getattr,958 .setattr = sf_setattr,959 .symlink = sf_symlink951 .getattr = vbsf_inode_getattr, 952 .setattr = vbsf_inode_setattr, 953 .symlink = vbsf_ino_symlink 960 954 #endif 961 955 }; -
trunk/src/VBox/Additions/linux/sharedfolders/lnkops.c
r77526 r77529 34 34 35 35 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) 36 36 37 # 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 # else41 static int sf_follow_link(struct dentry *dentry, struct nameidata *nd)38 static const char *vbsf_follow_link(struct dentry *dentry, void **cookie) 39 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) 40 static void *vbsf_follow_link(struct dentry *dentry, struct nameidata *nd) 41 # else 42 static int vbsf_follow_link(struct dentry *dentry, struct nameidata *nd) 42 43 # endif 43 44 { … … 51 52 if (path) { 52 53 error = 0; 53 rc = VbglR0SfReadLink(& client_handle, &sf_g->map, sf_i->path,54 rc = VbglR0SfReadLink(&g_SfClient, &sf_g->map, sf_i->path, 54 55 PATH_MAX, path); 55 56 if (RT_FAILURE(rc)) { … … 63 64 # else 64 65 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) 66 67 return NULL; 67 # else68 # else 68 69 return 0; 69 # endif70 # endif70 # endif 71 # endif 71 72 } 72 73 73 74 # 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) 76 static void vbsf_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) 77 # else 78 static void vbsf_put_link(struct dentry *dentry, struct nameidata *nd) 79 # endif 80 80 { 81 81 char *page = nd_get_link(nd); … … 83 83 free_page((unsigned long)page); 84 84 } 85 # endif 85 # endif /* < 4.2.0 */ 86 86 87 # else /* LINUX_VERSION_CODE>= 4.5.0 */88 static const char *sf_get_link(struct dentry *dentry, struct inode *inode, 89 87 # else /* >= 4.5.0 */ 88 89 static const char *vbsf_get_link(struct dentry *dentry, struct inode *inode, struct delayed_call *done) 90 90 { 91 91 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(inode->i_sb); … … 99 99 if (!path) 100 100 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); 103 102 if (RT_FAILURE(rc)) { 104 LogFunc(("VbglR0SfReadLink failed, caller=%s, rc=%Rrc\n", 105 __func__, rc)); 103 LogFunc(("VbglR0SfReadLink failed, rc=%Rrc\n", rc)); 106 104 kfree(path); 107 105 return ERR_PTR(-EPROTO); … … 110 108 return path; 111 109 } 112 # endif /* LINUX_VERSION_CODE >= 4.5.0 */113 110 114 struct inode_operations sf_lnk_iops = { 111 # endif /* >= 4.5.0 */ 112 113 struct inode_operations vbsf_lnk_iops = { 115 114 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) 116 115 .readlink = generic_readlink, 117 116 # endif 118 117 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) 119 .get_link = sf_get_link118 .get_link = vbsf_get_link 120 119 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) 121 .follow_link = sf_follow_link,120 .follow_link = vbsf_follow_link, 122 121 .put_link = free_page_put_link, 123 122 # else 124 .follow_link = sf_follow_link,125 .put_link = sf_put_link123 .follow_link = vbsf_follow_link, 124 .put_link = vbsf_put_link 126 125 # endif 127 126 }; -
trunk/src/VBox/Additions/linux/sharedfolders/regops.c
r77526 r77529 58 58 * @param pInodeInfo The inode which handles to drop. 59 59 */ 60 void sf_handle_drop_chain(struct sf_inode_info *pInodeInfo)60 void vbsf_handle_drop_chain(struct sf_inode_info *pInodeInfo) 61 61 { 62 62 struct sf_handle *pCur, *pNext; 63 63 unsigned long fSavedFlags; 64 SFLOGFLOW((" sf_handle_drop_chain: %p\n", pInodeInfo));64 SFLOGFLOW(("vbsf_handle_drop_chain: %p\n", pInodeInfo)); 65 65 spin_lock_irqsave(&g_SfHandleLock, fSavedFlags); 66 66 … … 79 79 * Locates a handle that matches all the flags in @a fFlags. 80 80 * 81 * @returns Pointer to handle on success (retained), use sf_handle_release() to81 * @returns Pointer to handle on success (retained), use vbsf_handle_release() to 82 82 * release it. NULL if no suitable handle was found. 83 83 * @param pInodeInfo The inode info to search. … … 85 85 * @param fFlagsClear The flags that must be clear. 86 86 */ 87 struct sf_handle * sf_handle_find(struct sf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear)87 struct sf_handle *vbsf_handle_find(struct sf_inode_info *pInodeInfo, uint32_t fFlagsSet, uint32_t fFlagsClear) 88 88 { 89 89 struct sf_handle *pCur; … … 98 98 if (cRefs > 1) { 99 99 spin_unlock_irqrestore(&g_SfHandleLock, fSavedFlags); 100 SFLOGFLOW((" sf_handle_find: returns %p\n", pCur));100 SFLOGFLOW(("vbsf_handle_find: returns %p\n", pCur)); 101 101 return pCur; 102 102 } … … 107 107 108 108 spin_unlock_irqrestore(&g_SfHandleLock, fSavedFlags); 109 SFLOGFLOW((" sf_handle_find: returns NULL!\n"));109 SFLOGFLOW(("vbsf_handle_find: returns NULL!\n")); 110 110 return NULL; 111 111 } … … 113 113 114 114 /** 115 * Slow worker for sf_handle_release() that does the freeing.115 * Slow worker for vbsf_handle_release() that does the freeing. 116 116 * 117 117 * @returns 0 (ref count). … … 121 121 * @param pszCaller The caller name (for logging failures). 122 122 */ 123 uint32_t sf_handle_release_slow(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller)123 uint32_t vbsf_handle_release_slow(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller) 124 124 { 125 125 int rc; 126 126 unsigned long fSavedFlags; 127 127 128 SFLOGFLOW((" sf_handle_release_slow: %p (%s)\n", pHandle, pszCaller));128 SFLOGFLOW(("vbsf_handle_release_slow: %p (%s)\n", pHandle, pszCaller)); 129 129 130 130 /* … … 163 163 * @param pHandle The handle to add. 164 164 */ 165 void sf_handle_append(struct sf_inode_info *pInodeInfo, struct sf_handle *pHandle)165 void vbsf_handle_append(struct sf_inode_info *pInodeInfo, struct sf_handle *pHandle) 166 166 { 167 167 #ifdef VBOX_STRICT … … 170 170 unsigned long fSavedFlags; 171 171 172 SFLOGFLOW((" sf_handle_append: %p (to %p)\n", pHandle, pInodeInfo));172 SFLOGFLOW(("vbsf_handle_append: %p (to %p)\n", pHandle, pInodeInfo)); 173 173 AssertMsg((pHandle->fFlags & (SF_HANDLE_F_MAGIC_MASK | SF_HANDLE_F_ON_LIST)) == SF_HANDLE_F_MAGIC, 174 174 ("%p %#x\n", pHandle, pHandle->fFlags)); … … 198 198 && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) 199 199 200 void free_pipebuf(struct page *kpage) 200 /* 201 * Some pipe stuff we apparently need for 2.6.23-2.6.30. 202 */ 203 204 static void vbsf_free_pipebuf(struct page *kpage) 201 205 { 202 206 kunmap(kpage); … … 204 208 } 205 209 206 void *sf_pipe_buf_map(struct pipe_inode_info *pipe, 207 struct pipe_buffer *pipe_buf, int atomic) 210 static void *vbsf_pipe_buf_map(struct pipe_inode_info *pipe, struct pipe_buffer *pipe_buf, int atomic) 208 211 { 209 212 return 0; 210 213 } 211 214 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) 215 static void vbsf_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *pipe_buf) 216 { 217 } 218 219 static void vbsf_pipe_buf_unmap(struct pipe_inode_info *pipe, struct pipe_buffer *pipe_buf, void *map_data) 220 { 221 } 222 223 static int vbsf_pipe_buf_steal(struct pipe_inode_info *pipe, struct pipe_buffer *pipe_buf) 223 224 { 224 225 return 0; 225 226 } 226 227 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) 228 static 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 233 static int vbsf_pipe_buf_confirm(struct pipe_inode_info *info, struct pipe_buffer *pipe_buf) 235 234 { 236 235 return 0; 237 236 } 238 237 239 static struct pipe_buf_operations sf_pipe_buf_ops = {238 static struct pipe_buf_operations vbsf_pipe_buf_ops = { 240 239 .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, 247 246 }; 248 247 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? */ ); 248 static 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? */ ); 255 252 if (RT_FAILURE(rc)) { 256 253 LogFunc(("VbglR0SfRead failed. caller=%s, rc=%Rrc\n", caller, … … 264 261 # define UNLOCK_PIPE(pipe) do { if (pipe->inode) mutex_unlock(&pipe->inode->i_mutex); } while (0) 265 262 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) 263 ssize_t vbsf_splice_read(struct file *in, loff_t * poffset, struct pipe_inode_info *pipe, size_t len, unsigned int flags) 269 264 { 270 265 size_t bytes_remaining = len; … … 298 293 } 299 294 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); 302 296 uint32_t chunk = 0; 303 297 void *kbuf = kmap(kpage); 304 298 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); 308 300 if (retval < 0) 309 301 goto err; … … 320 312 } 321 313 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)); 326 315 pipebuf->page = kpage; 327 pipebuf->ops = & sf_pipe_buf_ops;316 pipebuf->ops = &vbsf_pipe_buf_ops; 328 317 pipebuf->len = req_size; 329 318 pipebuf->offset = 0; … … 341 330 goto err; 342 331 } 343 free_pipebuf(kpage);332 vbsf_free_pipebuf(kpage); 344 333 break; 345 334 } … … 353 342 err: 354 343 UNLOCK_PIPE(pipe); 355 free_pipebuf(kpage);344 vbsf_free_pipebuf(kpage); 356 345 return retval; 357 346 } … … 360 349 361 350 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(). */ 352 DECLINLINE(void) vbsf_unlock_user_pages(struct page **papPages, size_t cPages, bool fSetDirty) 364 353 { 365 354 while (cPages-- > 0) … … 378 367 379 368 /** Wrapper around get_user_pages. */ 380 DECLINLINE(int) sf_lock_user_pages(uintptr_t uPtrFrom, size_t cPages, bool fWrite, struct page **papPages)369 DECLINLINE(int) vbsf_lock_user_pages(uintptr_t uPtrFrom, size_t cPages, bool fWrite, struct page **papPages) 381 370 { 382 371 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) … … 400 389 return cPagesLocked; 401 390 402 sf_unlock_user_pages(papPages, cPagesLocked, false /*fSetDirty*/);391 vbsf_unlock_user_pages(papPages, cPagesLocked, false /*fSetDirty*/); 403 392 404 393 /* We could use uPtrFrom + cPagesLocked to get the correct status here... */ … … 413 402 * the file content. 414 403 */ 415 static ssize_t sf_reg_read_mapped(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off)404 static ssize_t vbsf_reg_read_mapped(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off) 416 405 { 417 406 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) … … 452 441 453 442 /** 454 * Fallback case of sf_reg_read() that locks the user buffers and let the host443 * Fallback case of vbsf_reg_read() that locks the user buffers and let the host 455 444 * write directly to them. 456 445 */ 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)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) 459 448 { 460 449 /* … … 497 486 } 498 487 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); 500 489 if (rc == 0) { 501 490 size_t iPage = cPages; … … 512 501 rc = VbglR0SfHostReqReadPgLst(sf_g->map.root, pReq, sf_r->Handle.hHost, offFile, cbChunk, cPages); 513 502 514 sf_unlock_user_pages(papPages, cPages, true /*fSetDirty*/);503 vbsf_unlock_user_pages(papPages, cPages, true /*fSetDirty*/); 515 504 516 505 if (RT_SUCCESS(rc)) { … … 569 558 * @returns the number of read bytes on success, Linux error code otherwise 570 559 */ 571 static ssize_t sf_reg_read(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off)560 static ssize_t vbsf_reg_read(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off) 572 561 { 573 562 struct inode *inode = GET_F_DENTRY(file)->d_inode; … … 576 565 struct address_space *mapping = inode->i_mapping; 577 566 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)); 579 568 580 569 if (!S_ISREG(inode->i_mode)) { … … 599 588 && !(file->f_flags & O_DIRECT) 600 589 && 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); 602 591 603 592 /* … … 658 647 #endif 659 648 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); 661 650 } 662 651 … … 664 653 /** 665 654 * 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 */ 657 DECLINLINE(void) vbsf_reg_write_invalidate_mapping_range(struct address_space *mapping, loff_t offStart, loff_t offEnd) 669 658 { 670 659 /* … … 691 680 692 681 /** 693 * Fallback case of sf_reg_write() that locks the user buffers and let the host682 * Fallback case of vbsf_reg_write() that locks the user buffers and let the host 694 683 * write directly to them. 695 684 */ 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)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) 699 688 { 700 689 /* … … 736 725 } 737 726 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); 739 728 if (rc == 0) { 740 729 size_t iPage = cPages; … … 751 740 rc = VbglR0SfHostReqWritePgLst(sf_g->map.root, pReq, sf_r->Handle.hHost, offFile, cbChunk, cPages); 752 741 753 sf_unlock_user_pages(papPages, cPages, false /*fSetDirty*/);742 vbsf_unlock_user_pages(papPages, cPages, false /*fSetDirty*/); 754 743 755 744 if (RT_SUCCESS(rc)) { … … 765 754 if (offFile > i_size_read(inode)) 766 755 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); 768 757 769 758 /* … … 812 801 * @returns the number of written bytes on success, Linux error code otherwise 813 802 */ 814 static ssize_t sf_reg_write(struct file *file, const char *buf, size_t size, 815 loff_t * off) 803 static ssize_t vbsf_reg_write(struct file *file, const char *buf, size_t size, loff_t * off) 816 804 { 817 805 struct inode *inode = GET_F_DENTRY(file)->d_inode; … … 822 810 loff_t pos; 823 811 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)); 825 813 BUG_ON(!sf_i); 826 814 BUG_ON(!sf_g); … … 882 870 if (pos > i_size_read(inode)) 883 871 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); 885 873 } else 886 874 cbRet = -EPROTO; … … 916 904 if (pos > i_size_read(inode)) 917 905 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); 919 907 } else 920 908 cbRet = -EPROTO; … … 933 921 #endif 934 922 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); 936 924 } 937 925 … … 944 932 * @returns 0 on success, Linux error code otherwise 945 933 */ 946 static int sf_reg_open(struct inode *inode, struct file *file)934 static int vbsf_reg_open(struct inode *inode, struct file *file) 947 935 { 948 936 int rc, rc_linux = 0; … … 960 948 SHFLCREATEPARMS *pCreateParms; /* temp glue */ 961 949 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", 963 951 inode, file, file->f_flags, sf_i ? sf_i->path->String.ach : NULL)); 964 952 BUG_ON(!sf_g); … … 979 967 if (sf_i->handle != SHFL_HANDLE_NIL) { 980 968 /* 981 * This inode was created with sf_create_aux(). Check the CreateFlags:969 * This inode was created with vbsf_create_worker(). Check the CreateFlags: 982 970 * O_CREAT, O_TRUNC: inherent true (file was just created). Not sure 983 971 * about the access flags (SHFL_CF_ACCESS_*). … … 989 977 990 978 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)); 993 981 return 0; 994 982 } … … 1057 1045 1058 1046 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)); 1060 1048 rc = VbglR0SfHostReqCreate(sf_g->map.root, pReq); 1061 1049 if (RT_FAILURE(rc)) { … … 1067 1055 1068 1056 if (pCreateParms->Handle != SHFL_HANDLE_NIL) { 1069 sf_dentry_chain_increase_ttl(dentry);1057 vbsf_dentry_chain_increase_ttl(dentry); 1070 1058 rc_linux = 0; 1071 1059 } else { … … 1079 1067 break; 1080 1068 case SHFL_FILE_EXISTS: 1081 sf_dentry_chain_increase_ttl(dentry);1069 vbsf_dentry_chain_increase_ttl(dentry); 1082 1070 rc_linux = -EEXIST; 1083 1071 break; 1084 1072 default: 1085 sf_dentry_chain_increase_parent_ttl(dentry);1073 vbsf_dentry_chain_increase_parent_ttl(dentry); 1086 1074 rc_linux = 0; 1087 1075 break; … … 1092 1080 sf_r->Handle.hHost = pCreateParms->Handle; 1093 1081 file->private_data = sf_r; 1094 sf_handle_append(sf_i, &sf_r->Handle);1082 vbsf_handle_append(sf_i, &sf_r->Handle); 1095 1083 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)); 1097 1085 return rc_linux; 1098 1086 } … … 1106 1094 * @returns 0 on success, Linux error code otherwise 1107 1095 */ 1108 static int sf_reg_release(struct inode *inode, struct file *file)1096 static int vbsf_reg_release(struct inode *inode, struct file *file) 1109 1097 { 1110 1098 struct sf_reg_info *sf_r; … … 1112 1100 struct sf_inode_info *sf_i = GET_INODE_INFO(inode); 1113 1101 1114 SFLOGFLOW((" sf_reg_release: inode=%p file=%p\n", inode, file));1102 SFLOGFLOW(("vbsf_reg_release: inode=%p file=%p\n", inode, file)); 1115 1103 sf_g = VBSF_GET_SUPER_INFO(inode->i_sb); 1116 1104 sf_r = file->private_data; … … 1132 1120 /* Release sf_r, closing the handle if we're the last user. */ 1133 1121 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"); 1135 1123 1136 1124 sf_i->handle = SHFL_HANDLE_NIL; … … 1147 1135 * relative seeks. 1148 1136 */ 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));1137 static 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)); 1152 1140 1153 1141 switch (whence) { … … 1158 1146 case SEEK_END: { 1159 1147 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*/, 1161 1149 false /*fInodeLocked*/); 1162 1150 if (rc == 0) … … 1182 1170 */ 1183 1171 #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)1172 static int vbsf_reg_fsync(struct file *file, loff_t start, loff_t end, int datasync) 1185 1173 { 1186 1174 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) … … 1191 1179 } 1192 1180 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) 1193 static int sf_reg_fsync(struct file *file, int datasync)1181 static int vbsf_reg_fsync(struct file *file, int datasync) 1194 1182 { 1195 1183 return generic_file_fsync(file, datasync); 1196 1184 } 1197 1185 #else /* < 2.6.35 */ 1198 static int sf_reg_fsync(struct file *file, struct dentry *dentry, int datasync)1186 static int vbsf_reg_fsync(struct file *file, struct dentry *dentry, int datasync) 1199 1187 { 1200 1188 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) … … 1232 1220 1233 1221 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 */ 1225 struct 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, 1239 1230 .mmap = generic_file_mmap, 1240 1231 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) … … 1243 1234 * cached. Investigate. */ 1244 1235 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) 1245 .splice_read = sf_splice_read,1236 .splice_read = vbsf_splice_read, 1246 1237 # else 1247 1238 .sendfile = generic_file_sendfile, … … 1251 1242 # endif 1252 1243 #endif 1253 .llseek = sf_reg_llseek,1254 .fsync = sf_reg_fsync,1244 .llseek = vbsf_reg_llseek, 1245 .fsync = vbsf_reg_fsync, 1255 1246 }; 1256 1247 1257 struct inode_operations sf_reg_iops = {1248 struct inode_operations vbsf_reg_iops = { 1258 1249 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) 1259 .revalidate = sf_inode_revalidate1250 .revalidate = vbsf_inode_revalidate 1260 1251 #else 1261 .getattr = sf_getattr,1262 .setattr = sf_setattr1252 .getattr = vbsf_inode_getattr, 1253 .setattr = vbsf_inode_setattr 1263 1254 #endif 1264 1255 }; 1256 1265 1257 1266 1258 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) … … 1272 1264 * shared+writeable fashion. 1273 1265 */ 1274 static int sf_readpage(struct file *file, struct page *page)1266 static int vbsf_readpage(struct file *file, struct page *page) 1275 1267 { 1276 1268 struct inode *inode = GET_F_DENTRY(file)->d_inode; 1277 1269 int err; 1278 1270 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)); 1280 1272 1281 1273 if (!is_bad_inode(inode)) { … … 1330 1322 * fashion. 1331 1323 */ 1332 static int sf_writepage(struct page *page, struct writeback_control *wbc)1324 static int vbsf_writepage(struct page *page, struct writeback_control *wbc) 1333 1325 { 1334 1326 struct address_space *mapping = page->mapping; 1335 1327 struct inode *inode = mapping->host; 1336 1328 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); 1338 1330 int err; 1339 1331 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", 1341 1333 inode, page,(uint64_t)page->index << PAGE_SHIFT, pHandle, pHandle->hHost)); 1342 1334 … … 1382 1374 } else 1383 1375 err = -ENOMEM; 1384 sf_handle_release(pHandle, sf_g, "sf_writepage");1376 vbsf_handle_release(pHandle, sf_g, "vbsf_writepage"); 1385 1377 } else { 1386 1378 static uint64_t volatile s_cCalls = 0; 1387 1379 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); 1389 1381 err = -EPROTO; 1390 1382 } … … 1397 1389 * Called when writing thru the page cache (which we shouldn't be doing). 1398 1390 */ 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) 1391 int vbsf_write_begin(struct file *file, struct address_space *mapping, loff_t pos, 1392 unsigned len, unsigned flags, struct page **pagep, void **fsdata) 1402 1393 { 1403 1394 /** @todo r=bird: We shouldn't ever get here, should we? Because we don't use … … 1407 1398 static uint64_t volatile s_cCalls = 0; 1408 1399 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", 1410 1401 (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", 1412 1403 (unsigned long long)pos, len, flags); 1413 1404 # ifdef WARN_ON … … 1425 1416 */ 1426 1417 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) 1427 static ssize_t sf_direct_IO(struct kiocb *iocb, struct iov_iter *iter)1418 static ssize_t vbsf_direct_IO(struct kiocb *iocb, struct iov_iter *iter) 1428 1419 # 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)1420 static ssize_t vbsf_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset) 1430 1421 # 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)1422 static ssize_t vbsf_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, loff_t offset) 1432 1423 # 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)1424 static ssize_t vbsf_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs) 1434 1425 # 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)1426 static int vbsf_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs) 1436 1427 # 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)1428 static int vbsf_direct_IO(int rw, struct file *file, const struct iovec *iov, loff_t offset, unsigned long nr_segs) 1438 1429 # 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)1430 static int vbsf_direct_IO(int rw, struct inode *inode, const struct iovec *iov, loff_t offset, unsigned long nr_segs) 1440 1431 # 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)1432 static int vbsf_direct_IO(int rw, struct inode *inode, char *buf, loff_t offset, size_t count) 1442 1433 # else 1443 static int sf_direct_IO(int rw, struct inode *inode, struct kiobuf *, unsigned long, int)1434 static int vbsf_direct_IO(int rw, struct inode *inode, struct kiobuf *, unsigned long, int) 1444 1435 # endif 1445 1436 { … … 1449 1440 # endif 1450 1441 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 */ 1445 struct address_space_operations vbsf_reg_aops = { 1446 .readpage = vbsf_readpage, 1447 .writepage = vbsf_writepage, 1454 1448 /** @todo Need .writepages if we want msync performance... */ 1455 1449 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 12) … … 1457 1451 # endif 1458 1452 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) 1459 .write_begin = sf_write_begin,1453 .write_begin = vbsf_write_begin, 1460 1454 .write_end = simple_write_end, 1461 1455 # else … … 1464 1458 # endif 1465 1459 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 10) 1466 .direct_IO = sf_direct_IO,1460 .direct_IO = vbsf_direct_IO, 1467 1461 # endif 1468 1462 }; -
trunk/src/VBox/Additions/linux/sharedfolders/utils.c
r77526 r77529 41 41 */ 42 42 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) 43 DECLINLINE(void) sf_ftime_from_timespec(time_t *pLinuxDst, PCRTTIMESPEC pVBoxSrc)43 DECLINLINE(void) vbsf_time_to_linux(time_t *pLinuxDst, PCRTTIMESPEC pVBoxSrc) 44 44 { 45 45 int64_t t = RTTimeSpecGetNano(pVBoxSrc); … … 49 49 #else /* >= 2.6.0 */ 50 50 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) 51 DECLINLINE(void) sf_ftime_from_timespec(struct timespec *pLinuxDst, PCRTTIMESPEC pVBoxSrc)51 DECLINLINE(void) vbsf_time_to_linux(struct timespec *pLinuxDst, PCRTTIMESPEC pVBoxSrc) 52 52 # else 53 DECLINLINE(void) sf_ftime_from_timespec(struct timespec64 *pLinuxDst, PCRTTIMESPEC pVBoxSrc)53 DECLINLINE(void) vbsf_time_to_linux(struct timespec64 *pLinuxDst, PCRTTIMESPEC pVBoxSrc) 54 54 # endif 55 55 { … … 65 65 */ 66 66 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) 67 DECLINLINE(void) sf_timespec_from_ftime(PRTTIMESPEC pVBoxDst, time_t *pLinuxSrc)67 DECLINLINE(void) vbsf_time_to_vbox(PRTTIMESPEC pVBoxDst, time_t *pLinuxSrc) 68 68 { 69 69 RTTimeSpecSetNano(pVBoxDst, RT_NS_1SEC_64 * *pLinuxSrc); … … 71 71 #else /* >= 2.6.0 */ 72 72 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) 73 DECLINLINE(void) sf_timespec_from_ftime(PRTTIMESPEC pVBoxDst, struct timespec const *pLinuxSrc)73 DECLINLINE(void) vbsf_time_to_vbox(PRTTIMESPEC pVBoxDst, struct timespec const *pLinuxSrc) 74 74 # else 75 DECLINLINE(void) sf_timespec_from_ftime(PRTTIMESPEC pVBoxDst, struct timespec64 const *pLinuxSrc)75 DECLINLINE(void) vbsf_time_to_vbox(PRTTIMESPEC pVBoxDst, struct timespec64 const *pLinuxSrc) 76 76 # endif 77 77 { … … 82 82 83 83 /** 84 * Converts VBox access permissions to Linux ones (mode & 0777).84 * Converts Linux access permissions to VBox ones (mode & 0777). 85 85 * 86 86 * @note Currently identical. 87 87 */ 88 DECLINLINE( int) sf_convert_access_perms(uint32_t fAttr)88 DECLINLINE(uint32_t) sf_access_permissions_to_vbox(int fAttr) 89 89 { 90 90 /* Access bits should be the same: */ … … 104 104 105 105 /** 106 * Converts VBox access permissions to Linux ones (mode & 0777). 107 * 108 * @note Currently identical. 109 */ 110 DECLINLINE(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 /** 106 128 * Produce the Linux mode mask, given VBox, mount options and file type. 107 129 */ 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);130 DECLINLINE(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); 111 133 if (fFixedMode != ~0) 112 134 fLnxMode = fFixedMode & 0777; … … 120 142 * Initializes the @a inode attributes based on @a pObjInfo and @a sf_g options. 121 143 */ 122 void sf_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 sf_inode_info *sf_i, PSHFLFSOBJINFO pObjInfo, struct vbsf_super_info *sf_g) 123 145 { 124 146 PCSHFLFSOBJATTR pAttr = &pObjInfo->Attr; … … 130 152 131 153 #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; 133 155 # if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 19, 0) 134 156 inode->i_mapping->backing_dev_info = &sf_g->bdi; /* This is needed for mmap. */ … … 136 158 #endif 137 159 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; 141 163 142 164 /* XXX: this probably should be set to the number of entries … … 148 170 /** @todo r=bird: Aren't System V symlinks w/o any mode mask? IIRC there is 149 171 * 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; 152 174 set_nlink(inode, 1); 153 175 } 154 176 #endif 155 177 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; 159 181 set_nlink(inode, 1); 160 182 } … … 178 200 inode->i_blocks = (pObjInfo->cbAllocated + 511) / 512; 179 201 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); 183 205 sf_i->BirthTime = pObjInfo->BirthTime; 184 206 } … … 192 214 * @todo sort out the inode locking situation. 193 215 */ 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)216 static void vbsf_update_inode(struct inode *pInode, struct sf_inode_info *pInodeInfo, PSHFLFSOBJINFO pObjInfo, 217 struct vbsf_super_info *sf_g, bool fInodeLocked) 196 218 { 197 219 PCSHFLFSOBJATTR pAttr = &pObjInfo->Attr; … … 209 231 */ 210 232 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); 212 234 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 8) 213 235 else if (RTFS_IS_SYMLINK(pAttr->fMode)) 214 236 /** @todo r=bird: Aren't System V symlinks w/o any mode mask? IIRC there is 215 237 * 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); 217 239 #endif 218 240 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); 220 242 221 243 if (fMode == pInode->i_mode) { … … 225 247 pInode->i_mode = fMode; 226 248 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)); 229 251 /** @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); 231 253 232 254 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) … … 248 270 * Update the timestamps. 249 271 */ 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); 253 275 pInodeInfo->BirthTime = pObjInfo->BirthTime; 254 276 … … 267 289 268 290 /** @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) 291 int vbsf_stat(const char *caller, struct vbsf_super_info *sf_g, SHFLSTRING *path, PSHFLFSOBJINFO result, int ok_to_fail) 271 292 { 272 293 int rc; … … 313 334 * @sa sf_inode_revalidate() 314 335 */ 315 int sf_inode_revalidate_worker(struct dentry *dentry, bool fForced)336 int vbsf_inode_revalidate_worker(struct dentry *dentry, bool fForced) 316 337 { 317 338 int rc; … … 335 356 * Try get a handle we can query, any kind of handle will do here. 336 357 */ 337 struct sf_handle *pHandle = sf_handle_find(sf_i, 0, 0);358 struct sf_handle *pHandle = vbsf_handle_find(sf_i, 0, 0); 338 359 if (pHandle) { 339 360 /* Query thru pHandle. */ … … 346 367 * Reset the TTL and copy the info over into the inode structure. 347 368 */ 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??*/); 349 370 } else if (rc == VERR_INVALID_HANDLE) { 350 371 rc = -ENOENT; /* Restore.*/ … … 356 377 } else 357 378 rc = -ENOMEM; 358 sf_handle_release(pHandle, sf_g, "sf_inode_revalidate_worker");379 vbsf_handle_release(pHandle, sf_g, "vbsf_inode_revalidate_worker"); 359 380 360 381 } else { … … 374 395 * Reset the TTL and copy the info over into the inode structure. 375 396 */ 376 sf_update_inode(pInode, sf_i, &pReq->CreateParms.Info,397 vbsf_update_inode(pInode, sf_i, &pReq->CreateParms.Info, 377 398 sf_g, true /*fInodeLocked??*/); 378 399 rc = 0; … … 404 425 * 405 426 * 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 whether427 * vbsf_dentry_revalidate() on 2.4/2.6. The job is to find out whether 407 428 * 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 update429 * inode or vbsf_stat() is unsuccessful, otherwise we return success and update 409 430 * inode attributes. 410 431 */ 411 int sf_inode_revalidate(struct dentry *dentry)412 { 413 return sf_inode_revalidate_worker(dentry, false /*fForced*/);432 int vbsf_inode_revalidate(struct dentry *dentry) 433 { 434 return vbsf_inode_revalidate_worker(dentry, false /*fForced*/); 414 435 } 415 436 … … 419 440 * is quite a bit faster. 420 441 */ 421 int sf_inode_revalidate_with_handle(struct dentry *dentry, SHFLHANDLE hHostFile, bool fForced, bool fInodeLocked)442 int vbsf_inode_revalidate_with_handle(struct dentry *dentry, SHFLHANDLE hHostFile, bool fForced, bool fInodeLocked) 422 443 { 423 444 int err; … … 451 472 * Reset the TTL and copy the info over into the inode structure. 452 473 */ 453 sf_update_inode(pInode, sf_i, &pReq->ObjInfo, sf_g, fInodeLocked);474 vbsf_update_inode(pInode, sf_i, &pReq->ObjInfo, sf_g, fInodeLocked); 454 475 } else { 455 476 LogFunc(("VbglR0SfHostReqQueryObjInfo failed on %#RX64: %Rrc\n", hHostFile, err)); … … 471 492 472 493 # 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)494 int vbsf_inode_getattr(const struct path *path, struct kstat *kstat, u32 request_mask, unsigned int flags) 474 495 # else 475 int sf_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *kstat)496 int vbsf_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *kstat) 476 497 # endif 477 498 { … … 482 503 483 504 # 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)); 485 506 # else 486 SFLOGFLOW((" sf_getattr: dentry=%p\n", dentry));507 SFLOGFLOW(("vbsf_inode_setattr: dentry=%p\n", dentry)); 487 508 # endif 488 509 … … 494 515 switch (flags & AT_STATX_SYNC_TYPE) { 495 516 default: 496 rc = sf_inode_revalidate_worker(dentry, false /*fForced*/);517 rc = vbsf_inode_revalidate_worker(dentry, false /*fForced*/); 497 518 break; 498 519 499 520 case AT_STATX_FORCE_SYNC: 500 rc = sf_inode_revalidate_worker(dentry, true /*fForced*/);521 rc = vbsf_inode_revalidate_worker(dentry, true /*fForced*/); 501 522 break; 502 523 … … 506 527 } 507 528 # else 508 rc = sf_inode_revalidate_worker(dentry, false /*fForced*/);529 rc = vbsf_inode_revalidate_worker(dentry, false /*fForced*/); 509 530 # endif 510 531 if (rc == 0) { … … 517 538 struct sf_inode_info *pInodeInfo = GET_INODE_INFO(dentry->d_inode); 518 539 if (pInodeInfo) { 519 sf_ftime_from_timespec(&kstat->btime, &pInodeInfo->BirthTime);540 vbsf_time_to_linux(&kstat->btime, &pInodeInfo->BirthTime); 520 541 kstat->result_mask |= STATX_BTIME; 521 542 } … … 551 572 } 552 573 553 int sf_setattr(struct dentry *dentry, struct iattr *iattr)574 int vbsf_inode_setattr(struct dentry *dentry, struct iattr *iattr) 554 575 { 555 576 struct vbsf_super_info *sf_g; … … 611 632 * vbsf.cpp */ 612 633 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 615 634 RT_ZERO(*pInfo); 635 616 636 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); 628 638 if (iattr->ia_mode & S_IFDIR) 629 639 pInfo->Attr.fMode |= RTFS_TYPE_DIRECTORY; 640 else if (iattr->ia_mode & S_IFLNK) 641 pInfo->Attr.fMode |= RTFS_TYPE_SYMLINK; 630 642 else 631 643 pInfo->Attr.fMode |= RTFS_TYPE_FILE; … … 633 645 634 646 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); 636 648 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); 638 650 /* ignore ctime (inode change time) as it can't be set from userland anyway */ 639 651 … … 652 664 err = -RTErrConvertToErrno(vrc); 653 665 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)); 655 667 goto fail1; 656 668 } … … 672 684 * dentry and all its parent entries are valid and could touch their timestamps 673 685 * extending their TTL (CIFS does that). */ 674 return sf_inode_revalidate_worker(dentry, true /*fForced*/);686 return vbsf_inode_revalidate_worker(dentry, true /*fForced*/); 675 687 676 688 fail1: … … 686 698 #endif /* >= 2.6.0 */ 687 699 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)700 static int vbsf_make_path(const char *caller, struct sf_inode_info *sf_i, 701 const char *d_name, size_t d_len, SHFLSTRING **result) 690 702 { 691 703 size_t path_len, shflstring_len; … … 737 749 * [dentry] contains string encoded in coding system that corresponds 738 750 * 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 */ 753 int 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) 744 755 { 745 756 int err; … … 808 819 } 809 820 810 err = sf_make_path(caller, sf_i, name, len, result);821 err = vbsf_make_path(caller, sf_i, name, len, result); 811 822 if (name != d_name) 812 823 kfree(name); … … 819 830 } 820 831 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) 832 int vbsf_nlscpy(struct vbsf_super_info *sf_g, char *name, size_t name_bound_len, const unsigned char *utf8_name, size_t utf8_len) 824 833 { 825 834 if (sf_g->nls) { … … 878 887 } 879 888 880 static struct sf_dir_buf * sf_dir_buf_alloc(void)889 static struct sf_dir_buf *vbsf_dir_buf_alloc(void) 881 890 { 882 891 struct sf_dir_buf *b; … … 902 911 } 903 912 904 static void sf_dir_buf_free(struct sf_dir_buf *b)913 static void vbsf_dir_buf_free(struct sf_dir_buf *b) 905 914 { 906 915 BUG_ON(!b || !b->buf); … … 915 924 * Free the directory buffer. 916 925 */ 917 void sf_dir_info_free(struct sf_dir_info *p)926 void vbsf_dir_info_free(struct sf_dir_info *p) 918 927 { 919 928 struct list_head *list, *pos, *tmp; … … 925 934 926 935 b = list_entry(pos, struct sf_dir_buf, head); 927 sf_dir_buf_free(b);936 vbsf_dir_buf_free(b); 928 937 } 929 938 kfree(p); … … 933 942 * Empty (but not free) the directory buffer. 934 943 */ 935 void sf_dir_info_empty(struct sf_dir_info *p)944 void vbsf_dir_info_empty(struct sf_dir_info *p) 936 945 { 937 946 struct list_head *list, *pos, *tmp; … … 950 959 * Create a new directory buffer descriptor. 951 960 */ 952 struct sf_dir_info * sf_dir_info_alloc(void)961 struct sf_dir_info *vbsf_dir_info_alloc(void) 953 962 { 954 963 struct sf_dir_info *p; … … 968 977 * Search for an empty directory content buffer. 969 978 */ 970 static struct sf_dir_buf * sf_get_empty_dir_buf(struct sf_dir_info *sf_d)979 static struct sf_dir_buf *vbsf_get_empty_dir_buf(struct sf_dir_info *sf_d) 971 980 { 972 981 struct list_head *list, *pos; … … 990 999 /** @todo r=bird: Why on earth do we read in the entire directory??? This 991 1000 * 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) 1001 int vbsf_dir_read_all(struct vbsf_super_info *sf_g, struct sf_inode_info *sf_i, struct sf_dir_info *sf_d, SHFLHANDLE handle) 994 1002 { 995 1003 int err; … … 998 1006 999 1007 TRACE(); 1000 err = sf_make_path(__func__, sf_i, "*", 1, &mask);1008 err = vbsf_make_path(__func__, sf_i, "*", 1, &mask); 1001 1009 if (err) 1002 1010 goto fail0; … … 1009 1017 struct sf_dir_buf *b; 1010 1018 1011 b = sf_get_empty_dir_buf(sf_d);1019 b = vbsf_get_empty_dir_buf(sf_d); 1012 1020 if (!b) { 1013 b = sf_dir_buf_alloc();1021 b = vbsf_dir_buf_alloc(); 1014 1022 if (!b) { 1015 1023 err = -ENOMEM; … … 1049 1057 * This is called during name resolution/lookup to check if the @a dentry in the 1050 1058 * 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 */ 1054 1061 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) 1055 s f_dentry_revalidate(struct dentry *dentry, unsigned flags)1062 static int vbsf_dentry_revalidate(struct dentry *dentry, unsigned flags) 1056 1063 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 1057 s f_dentry_revalidate(struct dentry *dentry, struct nameidata *nd)1064 static int vbsf_dentry_revalidate(struct dentry *dentry, struct nameidata *nd) 1058 1065 #else 1059 s f_dentry_revalidate(struct dentry *dentry, int flags)1066 static int vbsf_dentry_revalidate(struct dentry *dentry, int flags) 1060 1067 #endif 1061 1068 { … … 1067 1074 1068 1075 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>")); 1070 1077 1071 1078 /* … … 1080 1087 if (flags & LOOKUP_RCU) { 1081 1088 rc = -ECHILD; 1082 SFLOGFLOW((" sf_dentry_revalidate: RCU -> -ECHILD\n"));1089 SFLOGFLOW(("vbsf_dentry_revalidate: RCU -> -ECHILD\n")); 1083 1090 } else 1084 1091 #endif … … 1098 1105 */ 1099 1106 //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; 1101 1108 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(dentry->d_sb); 1102 1109 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)); 1104 1111 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)); 1108 1115 rc = 1; 1109 1116 } 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)); 1111 1118 rc = 0; 1112 1119 } … … 1128 1135 #endif 1129 1136 { 1130 SFLOGFLOW((" sf_dentry_revalidate: negative: create or rename target -> 0\n"));1137 SFLOGFLOW(("vbsf_dentry_revalidate: negative: create or rename target -> 0\n")); 1131 1138 rc = 0; 1132 1139 } else { 1133 1140 /* 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; 1135 1142 struct vbsf_super_info *sf_g = VBSF_GET_SUPER_INFO(dentry->d_sb); 1136 1143 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)); 1138 1145 rc = 1; 1139 1146 } else { … … 1141 1148 have the caller kick it out. */ 1142 1149 /** @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)); 1144 1151 rc = 0; 1145 1152 } … … 1154 1161 /** For logging purposes only. */ 1155 1162 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) 1156 static int sf_dentry_delete(const struct dentry *pDirEntry)1163 static int vbsf_dentry_delete(const struct dentry *pDirEntry) 1157 1164 # else 1158 static int sf_dentry_delete(struct dentry *pDirEntry)1165 static int vbsf_dentry_delete(struct dentry *pDirEntry) 1159 1166 # endif 1160 1167 { 1161 SFLOGFLOW((" sf_dentry_delete: %p\n", pDirEntry));1168 SFLOGFLOW(("vbsf_dentry_delete: %p\n", pDirEntry)); 1162 1169 return 0; 1163 1170 } … … 1165 1172 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) 1166 1173 /** For logging purposes only. */ 1167 static int sf_dentry_init(struct dentry *pDirEntry)1168 { 1169 SFLOGFLOW((" sf_dentry_init: %p\n", pDirEntry));1174 static int vbsf_dentry_init(struct dentry *pDirEntry) 1175 { 1176 SFLOGFLOW(("vbsf_dentry_init: %p\n", pDirEntry)); 1170 1177 return 0; 1171 1178 } … … 1179 1186 * Since 2.6.38 this is used via the super_block::s_d_op member. 1180 1187 */ 1181 struct dentry_operations sf_dentry_ops = {1182 .d_revalidate = sf_dentry_revalidate,1188 struct dentry_operations vbsf_dentry_ops = { 1189 .d_revalidate = vbsf_dentry_revalidate, 1183 1190 #ifdef SFLOG_ENABLED 1184 .d_delete = sf_dentry_delete,1191 .d_delete = vbsf_dentry_delete, 1185 1192 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) 1186 .d_init = sf_dentry_init,1193 .d_init = vbsf_dentry_init, 1187 1194 # endif 1188 1195 #endif -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c
r77526 r77529 58 58 * Global Variables * 59 59 *********************************************************************************************************************************/ 60 VBGLSFCLIENT client_handle; 61 VBGLSFCLIENT g_SfClient; /* temporary? */ 62 63 uint32_t g_fHostFeatures = 0; /* temporary? */ 60 VBGLSFCLIENT g_SfClient; 61 uint32_t g_fHostFeatures = 0; 64 62 65 63 /** Protects all the sf_inode_info::HandleList lists. */ 66 spinlock_t g_SfHandleLock;64 spinlock_t g_SfHandleLock; 67 65 68 66 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 52) 69 static int g_fFollowSymlinks = 0;67 static int g_fFollowSymlinks = 0; 70 68 #endif 71 69 … … 78 76 * Copies options from the mount info structure into @a sf_g. 79 77 * 80 * This is used both by sf_super_info_alloc() andsf_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 */ 80 static void vbsf_super_info_copy_remount_options(struct vbsf_super_info *sf_g, struct vbsf_mount_info_new *info) 83 81 { 84 82 sf_g->ttl_msec = info->ttl; … … 132 130 133 131 /* 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)132 static int vbsf_super_info_alloc(struct vbsf_mount_info_new *info, struct vbsf_super_info **sf_gp) 135 133 { 136 134 int err, rc; … … 218 216 219 217 /* 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); 221 219 222 220 *sf_gp = sf_g; … … 235 233 236 234 /* unmap the share and free super info [sf_g] */ 237 static void sf_super_info_free(struct vbsf_super_info *sf_g)235 static void vbsf_super_info_free(struct vbsf_super_info *sf_g) 238 236 { 239 237 int rc; … … 254 252 * Initialize backing device related matters. 255 253 */ 256 static int sf_init_backing_dev(struct super_block *sb, struct vbsf_super_info *sf_g)254 static int vbsf_init_backing_dev(struct super_block *sb, struct vbsf_super_info *sf_g) 257 255 { 258 256 int rc = 0; … … 320 318 321 319 /** 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 */ 322 static void vbsf_done_backing_dev(struct super_block *sb, struct vbsf_super_info *sf_g) 325 323 { 326 324 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) && LINUX_VERSION_CODE <= KERNEL_VERSION(3, 19, 0) … … 331 329 332 330 /** 333 * This is called by sf_read_super_24() andsf_read_super_26() when vfs mounts331 * This is called by vbsf_read_super_24() and vbsf_read_super_26() when vfs mounts 334 332 * the fs and wants to read super_block. 335 333 * 336 * Calls sf_super_info_alloc() to map the folder and allocate super information334 * Calls vbsf_super_info_alloc() to map the folder and allocate super information 337 335 * structure. 338 336 * … … 341 339 * Should respect @a flags. 342 340 */ 343 static int sf_read_super_aux(struct super_block *sb, void *data, int flags)341 static int vbsf_read_super_aux(struct super_block *sb, void *data, int flags) 344 342 { 345 343 int err; … … 365 363 } 366 364 367 err = sf_super_info_alloc(info, &sf_g);365 err = vbsf_super_info_alloc(info, &sf_g); 368 366 if (err) 369 367 goto fail0; … … 394 392 #endif 395 393 396 err = sf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0);394 err = vbsf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0); 397 395 if (err) { 398 396 LogFunc(("could not stat root of share\n")); … … 414 412 sb->s_op = &sf_super_ops; 415 413 #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; 417 415 #endif 418 416 … … 428 426 } 429 427 430 if ( sf_init_backing_dev(sb, sf_g)) {428 if (vbsf_init_backing_dev(sb, sf_g)) { 431 429 err = -EINVAL; 432 430 LogFunc(("could not init bdi\n")); … … 437 435 } 438 436 439 sf_init_inode(iroot, sf_i, &fsinfo, sf_g);437 vbsf_init_inode(iroot, sf_i, &fsinfo, sf_g); 440 438 SET_INODE_INFO(iroot, sf_i); 441 439 … … 463 461 464 462 fail5: 465 sf_done_backing_dev(sb, sf_g);463 vbsf_done_backing_dev(sb, sf_g); 466 464 467 465 fail4: … … 476 474 477 475 fail1: 478 sf_super_info_free(sf_g);476 vbsf_super_info_free(sf_g); 479 477 480 478 fail0: … … 489 487 */ 490 488 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) 491 static void sf_evict_inode(struct inode *inode)489 static void vbsf_evict_inode(struct inode *inode) 492 490 #else 493 static void sf_clear_inode(struct inode *inode)491 static void vbsf_clear_inode(struct inode *inode) 494 492 #endif 495 493 { … … 519 517 BUG_ON(!sf_i->path); 520 518 kfree(sf_i->path); 521 sf_handle_drop_chain(sf_i);519 vbsf_handle_drop_chain(sf_i); 522 520 # ifdef VBOX_STRICT 523 521 sf_i->u32Magic = SF_INODE_INFO_MAGIC_DEAD; … … 533 531 job to properly fill then [inode] */ 534 532 #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 unmap533 static 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 542 540 the folder and free [sf_g] */ 543 static void sf_put_super(struct super_block *sb)541 static void vbsf_put_super(struct super_block *sb) 544 542 { 545 543 struct vbsf_super_info *sf_g; … … 547 545 sf_g = VBSF_GET_SUPER_INFO(sb); 548 546 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); 551 549 } 552 550 … … 556 554 */ 557 555 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18) 558 static int sf_statfs(struct dentry *dentry, struct kstatfs *stat)556 static int vbsf_statfs(struct dentry *dentry, struct kstatfs *stat) 559 557 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 73) 560 static int sf_statfs(struct super_block *sb, struct kstatfs *stat)558 static int vbsf_statfs(struct super_block *sb, struct kstatfs *stat) 561 559 #else 562 static int sf_statfs(struct super_block *sb, struct statfs *stat)560 static int vbsf_statfs(struct super_block *sb, struct statfs *stat) 563 561 #endif 564 562 { … … 603 601 } 604 602 605 static int sf_remount_fs(struct super_block *sb, int *flags, char *data)603 static int vbsf_remount_fs(struct super_block *sb, int *flags, char *data) 606 604 { 607 605 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 23) … … 620 618 && info->signature[1] == VBSF_MOUNT_SIGNATURE_BYTE_1 621 619 && 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); 623 621 } 624 622 } … … 629 627 630 628 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); 632 630 BUG_ON(err != 0); 633 sf_init_inode(iroot, sf_i, &fsinfo, sf_g);631 vbsf_init_inode(iroot, sf_i, &fsinfo, sf_g); 634 632 /*unlock_new_inode(iroot); */ 635 633 return 0; … … 647 645 */ 648 646 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) 649 static int sf_show_options(struct seq_file *m, struct vfsmount *mnt)647 static int vbsf_show_options(struct seq_file *m, struct vfsmount *mnt) 650 648 #else 651 static int sf_show_options(struct seq_file *m, struct dentry *root)649 static int vbsf_show_options(struct seq_file *m, struct dentry *root) 652 650 #endif 653 651 { … … 676 674 static struct super_operations sf_super_ops = { 677 675 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) 678 .clear_inode = sf_clear_inode,676 .clear_inode = vbsf_clear_inode, 679 677 #else 680 .evict_inode = sf_evict_inode,678 .evict_inode = vbsf_evict_inode, 681 679 #endif 682 680 #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_options681 .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 689 687 }; 690 688 … … 696 694 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 4) 697 695 698 static int sf_read_super_26(struct super_block *sb, void *data, int flags)696 static int vbsf_read_super_26(struct super_block *sb, void *data, int flags) 699 697 { 700 698 int err; 701 699 702 700 TRACE(); 703 err = sf_read_super_aux(sb, data, flags);701 err = vbsf_read_super_aux(sb, data, flags); 704 702 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); 706 704 707 705 return err; … … 709 707 710 708 # 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); 709 static 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); 717 713 } 718 714 # 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); 715 static 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); 724 719 } 725 720 # 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); 721 static 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); 731 725 } 732 726 # endif /* LINUX_VERSION_CODE >= 2.6.39 */ … … 736 730 .name = "vboxsf", 737 731 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) 738 .get_sb = sf_get_sb,732 .get_sb = vbsf_get_sb, 739 733 # else 740 734 .mount = sf_mount, … … 745 739 #else /* LINUX_VERSION_CODE < 2.5.4 */ 746 740 747 static struct super_block *sf_read_super_24(struct super_block *sb, void *data, 748 int flags) 741 static struct super_block *vbsf_read_super_24(struct super_block *sb, void *data, int flags) 749 742 { 750 743 int err; 751 744 752 745 TRACE(); 753 err = sf_read_super_aux(sb, data, flags);746 err = vbsf_read_super_aux(sb, data, flags); 754 747 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); 756 749 return NULL; 757 750 } … … 760 753 } 761 754 762 static DECLARE_FSTYPE(vboxsf_fs_type, "vboxsf", sf_read_super_24, 0);755 static DECLARE_FSTYPE(vboxsf_fs_type, "vboxsf", vbsf_read_super_24, 0); 763 756 764 757 #endif /* LINUX_VERSION_CODE < 2.5.4 */ … … 768 761 static int __init init(void) 769 762 { 763 int rcRet = 0; 770 764 int vrc; 771 int rcRet = 0;772 765 int err; 773 766 774 767 TRACE(); 775 768 769 AssertCompile(sizeof(struct vbsf_mount_info_new) <= PAGE_SIZE); 776 770 if (sizeof(struct vbsf_mount_info_new) > PAGE_SIZE) { 777 771 printk(KERN_ERR … … 799 793 } 800 794 801 vrc = VbglR0SfConnect(&client_handle); 802 g_SfClient = client_handle; /* temporary */ 795 vrc = VbglR0SfConnect(&g_SfClient); 803 796 if (RT_FAILURE(vrc)) { 804 797 LogRelFunc(("VbglR0SfConnect failed, vrc=%Rrc\n", vrc)); … … 815 808 LogRelFunc(("g_fHostFeatures=%#x\n", g_fHostFeatures)); 816 809 817 vrc = VbglR0SfSetUtf8(& client_handle);810 vrc = VbglR0SfSetUtf8(&g_SfClient); 818 811 if (RT_FAILURE(vrc)) { 819 812 LogRelFunc(("VbglR0SfSetUtf8 failed, vrc=%Rrc\n", vrc)); … … 823 816 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 824 817 if (!g_fFollowSymlinks) { 825 vrc = VbglR0SfSetSymlinks(& client_handle);818 vrc = VbglR0SfSetSymlinks(&g_SfClient); 826 819 if (RT_FAILURE(vrc)) { 827 820 printk(KERN_WARNING … … 839 832 840 833 fail2: 841 VbglR0SfDisconnect(&client_handle); 842 g_SfClient = client_handle; /* temporary */ 834 VbglR0SfDisconnect(&g_SfClient); 843 835 844 836 fail1: … … 854 846 TRACE(); 855 847 856 VbglR0SfDisconnect(&client_handle); 857 g_SfClient = client_handle; /* temporary */ 848 VbglR0SfDisconnect(&g_SfClient); 858 849 VbglR0SfTerm(); 859 850 unregister_filesystem(&vboxsf_fs_type); -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h
r77526 r77529 127 127 * For associating inodes with host handles. 128 128 * 129 * This is necessary for address_space_operations:: sf_writepage and allows129 * This is necessary for address_space_operations::vbsf_writepage and allows 130 130 * optimizing stat, lookups and other operations on open files and directories. 131 131 */ … … 166 166 /** Some information was changed, update data on next revalidate */ 167 167 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 */ 169 169 bool force_reread; 170 170 /** The timestamp (jiffies) where the inode info was last updated. */ … … 173 173 RTTIMESPEC BirthTime; 174 174 175 /** handle valid if a file was created with sf_create_auxuntil it will176 * 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() 177 177 * @todo r=bird: figure this one out... */ 178 178 SHFLHANDLE handle; … … 187 187 }; 188 188 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 189 199 struct sf_dir_info { 190 200 /** @todo sf_handle. */ … … 219 229 * specific code (at least going back to 2.4.0). 220 230 */ 221 DECLINLINE(void) sf_dentry_set_update_jiffies(struct dentry *pDirEntry, unsigned long uToSet)231 DECLINLINE(void) vbsf_dentry_set_update_jiffies(struct dentry *pDirEntry, unsigned long uToSet) 222 232 { 223 233 pDirEntry->d_fsdata = (void *)uToSet; … … 227 237 * Get the update-jiffies value for a dentry. 228 238 */ 229 DECLINLINE(unsigned long) sf_dentry_get_update_jiffies(struct dentry *pDirEntry)239 DECLINLINE(unsigned long) vbsf_dentry_get_update_jiffies(struct dentry *pDirEntry) 230 240 { 231 241 return (unsigned long)pDirEntry->d_fsdata; … … 237 247 * we should increase the TTL for. 238 248 */ 239 DECLINLINE(void) sf_dentry_chain_increase_ttl(struct dentry *pDirEntry)249 DECLINLINE(void) vbsf_dentry_chain_increase_ttl(struct dentry *pDirEntry) 240 250 { 241 251 #ifdef VBOX_STRICT … … 245 255 do { 246 256 Assert(pDirEntry->d_sb == pSuper); 247 sf_dentry_set_update_jiffies(pDirEntry, uToSet);257 vbsf_dentry_set_update_jiffies(pDirEntry, uToSet); 248 258 pDirEntry = pDirEntry->d_parent; 249 259 } while (!IS_ROOT(pDirEntry)); … … 255 265 * we should increase the TTL for. 256 266 */ 257 DECLINLINE(void) sf_dentry_chain_increase_parent_ttl(struct dentry *pDirEntry)267 DECLINLINE(void) vbsf_dentry_chain_increase_parent_ttl(struct dentry *pDirEntry) 258 268 { 259 269 Assert(!pDirEntry->d_parent || pDirEntry->d_parent->d_sb == pDirEntry->d_sb); 260 270 pDirEntry = pDirEntry->d_parent; 261 271 if (pDirEntry) 262 sf_dentry_chain_increase_ttl(pDirEntry);272 vbsf_dentry_chain_increase_ttl(pDirEntry); 263 273 } 264 274 265 275 266 276 /* globals */ 267 extern VBGLSFCLIENT client_handle;277 extern VBGLSFCLIENT g_SfClient; 268 278 extern spinlock_t g_SfHandleLock; 269 279 270 280 271 281 /* 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);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); 284 294 285 295 /** … … 289 299 * @param pHandle The handle to release. 290 300 * @param sf_g The info structure for the shared folder associated 291 * with the handle.301 * with the handle. 292 302 * @param pszCaller The caller name (for logging failures). 293 303 */ 294 DECLINLINE(uint32_t) sf_handle_release(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller)304 DECLINLINE(uint32_t) vbsf_handle_release(struct sf_handle *pHandle, struct vbsf_super_info *sf_g, const char *pszCaller) 295 305 { 296 306 uint32_t cRefs; … … 304 314 if (cRefs) 305 315 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 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); 321 extern int vbsf_inode_revalidate(struct dentry *dentry); 322 extern int vbsf_inode_revalidate_worker(struct dentry *dentry, bool fForced); 323 extern int vbsf_inode_revalidate_with_handle(struct dentry *dentry, SHFLHANDLE hHostFile, bool fForced, bool fInodeLocked); 315 324 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 316 325 # 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); 326 extern int vbsf_inode_getattr(const struct path *path, struct kstat *kstat, u32 request_mask, unsigned int query_flags); 319 327 # else 320 extern int sf_getattr(struct vfsmount *mnt, struct dentry *dentry, 321 struct kstat *kstat); 328 extern int vbsf_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *kstat); 322 329 # 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 330 extern int vbsf_inode_setattr(struct dentry *dentry, struct iattr *iattr); 331 #endif 332 extern 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); 334 extern 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); 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); 343 341 344 342 #if 1 … … 354 352 #endif 355 353 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_i360 #else361 /* 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_i364 #endif365 366 354 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) 367 355 # define GET_F_DENTRY(f) (f->f_path.dentry)
Note:
See TracChangeset
for help on using the changeset viewer.