Changeset 85698 in vbox for trunk/src/VBox/Additions/linux/sharedfolders
- Timestamp:
- Aug 11, 2020 5:05:29 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139838
- Location:
- trunk/src/VBox/Additions/linux/sharedfolders
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/dirops.c
r82968 r85698 36 36 #include <iprt/err.h> 37 37 38 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7,0)38 #if RTLNX_VER_MAX(4,7,0) 39 39 # define d_in_lookup(a_pDirEntry) (d_unhashed(a_pDirEntry)) 40 40 #endif … … 280 280 */ 281 281 DECL_NO_INLINE(static, bool) vbsf_dir_emit_nls( 282 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11,0)282 # if RTLNX_VER_MIN(3,11,0) 283 283 struct dir_context *ctx, 284 284 # else … … 291 291 int rc = vbsf_nlscpy(pSuperInfo, szDstName, sizeof(szDstName), pszSrcName, cchSrcName); 292 292 if (rc == 0) { 293 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11,0)293 #if RTLNX_VER_MIN(3,11,0) 294 294 return dir_emit(ctx, szDstName, strlen(szDstName), d_ino, d_type); 295 295 #else … … 327 327 * c. filldir returns an error (see comment on that) 328 328 */ 329 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11,0)329 #if RTLNX_VER_MIN(3,11,0) 330 330 static int vbsf_dir_iterate(struct file *dir, struct dir_context *ctx) 331 331 #else … … 333 333 #endif 334 334 { 335 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11,0)335 #if RTLNX_VER_MIN(3,11,0) 336 336 loff_t offPos = ctx->pos; 337 337 #else … … 403 403 */ 404 404 if (offPos < 2) { 405 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11,0)405 #if RTLNX_VER_MIN(3,11,0) 406 406 if (offPos == 0) { 407 407 if (dir_emit_dot(dir, ctx)) … … 431 431 } 432 432 if (offPos == 1) { 433 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,5)433 # if RTLNX_VER_MIN(2,5,5) 434 434 rc = filldir(opaque, "..", 2, 1, parent_ino(VBSF_GET_F_DENTRY(dir)), DT_DIR); 435 435 # else … … 506 506 bool fContinue; 507 507 if (pSuperInfo->fNlsIsUtf8) { 508 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11,0)508 #if RTLNX_VER_MIN(3,11,0) 509 509 fContinue = dir_emit(ctx, pEntry->name.String.ach, cchSrcName, d_ino, d_type); 510 510 #else … … 512 512 #endif 513 513 } else { 514 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11,0)514 #if RTLNX_VER_MIN(3,11,0) 515 515 fContinue = vbsf_dir_emit_nls(ctx, pEntry->name.String.ach, cchSrcName, d_ino, d_type, pSuperInfo); 516 516 #else … … 536 536 offPos += 1; 537 537 dir->f_pos = offPos; 538 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11,0)538 #if RTLNX_VER_MIN(3,11,0) 539 539 ctx->pos = offPos; 540 540 #endif … … 555 555 struct file_operations vbsf_dir_fops = { 556 556 .open = vbsf_dir_open, 557 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7,0)557 #if RTLNX_VER_MIN(4,7,0) 558 558 .iterate_shared = vbsf_dir_iterate, 559 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11,0)559 #elif RTLNX_VER_MIN(3,11,0) 560 560 .iterate = vbsf_dir_iterate, 561 561 #else … … 564 564 .release = vbsf_dir_release, 565 565 .read = generic_read_dir, 566 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,37)566 #if RTLNX_VER_MIN(2,6,37) 567 567 .llseek = generic_file_llseek 568 568 #endif … … 588 588 if (sf_new_i) { 589 589 ino_t iNodeNo = iunique(parent->i_sb, 16); 590 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,25)590 #if RTLNX_VER_MIN(2,4,25) 591 591 struct inode *pInode = iget_locked(parent->i_sb, iNodeNo); 592 592 #else … … 614 614 if (fInstantiate) 615 615 d_instantiate(dentry, pInode); 616 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,25)616 #if RTLNX_VER_MIN(2,4,25) 617 617 unlock_new_inode(pInode); 618 618 #endif … … 632 632 DECLINLINE(void) vbsf_d_add_inode(struct dentry *dentry, struct inode *pNewInode) 633 633 { 634 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,38)634 #if RTLNX_VER_MIN(2,6,38) 635 635 Assert(dentry->d_op == &vbsf_dentry_ops); /* (taken from the superblock) */ 636 636 #else … … 651 651 */ 652 652 static struct dentry *vbsf_inode_lookup(struct inode *parent, struct dentry *dentry 653 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6,0)653 #if RTLNX_VER_MIN(3,6,0) 654 654 , unsigned int flags 655 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0)655 #elif RTLNX_VER_MIN(2,6,0) 656 656 , struct nameidata *nd 657 657 #endif … … 664 664 int rc; 665 665 666 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6,0)666 #if RTLNX_VER_MIN(3,6,0) 667 667 SFLOGFLOW(("vbsf_inode_lookup: parent=%p dentry=%p flags=%#x\n", parent, dentry, flags)); 668 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0)668 #elif RTLNX_VER_MIN(2,6,0) 669 669 SFLOGFLOW(("vbsf_inode_lookup: parent=%p dentry=%p nd=%p{.flags=%#x}\n", parent, dentry, nd, nd ? nd->flags : 0)); 670 670 #else … … 920 920 921 921 922 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)922 #if RTLNX_VER_MIN(3,16,0) 923 923 /** 924 924 * More atomic way of handling creation. … … 930 930 static int vbsf_inode_atomic_open(struct inode *pDirInode, struct dentry *dentry, struct file *file, unsigned fOpen, 931 931 umode_t fMode 932 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19,0)932 # if RTLNX_VER_MAX(4,19,0) 933 933 , int *opened 934 934 # endif … … 982 982 * and call finish_open() to do the remaining open() work. 983 983 */ 984 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19,0)984 # if RTLNX_VER_MIN(4,19,0) 985 985 if (fCreated) 986 986 file->f_mode |= FMODE_CREATED; … … 1045 1045 * @returns 0 on success, Linux error code otherwise 1046 1046 */ 1047 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6,0) || defined(DOXYGEN_RUNNING)1047 #if RTLNX_VER_MIN(3,6,0) || defined(DOXYGEN_RUNNING) 1048 1048 static int vbsf_inode_create(struct inode *parent, struct dentry *dentry, umode_t mode, bool excl) 1049 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3,0)1049 #elif RTLNX_VER_MIN(3,3,0) 1050 1050 static int vbsf_inode_create(struct inode *parent, struct dentry *dentry, umode_t mode, struct nameidata *nd) 1051 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,75)1051 #elif RTLNX_VER_MIN(2,5,75) 1052 1052 static int vbsf_inode_create(struct inode *parent, struct dentry *dentry, int mode, struct nameidata *nd) 1053 1053 #else … … 1058 1058 | SHFL_CF_ACT_FAIL_IF_EXISTS 1059 1059 | SHFL_CF_ACCESS_READWRITE; 1060 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 75)1060 #if RTLNX_VER_RANGE(2,5,75, 3,6,0) 1061 1061 /* Clear the RD flag if write-only access requested. Otherwise assume we 1062 1062 need write access to create stuff. */ … … 1082 1082 * @returns 0 on success, Linux error code otherwise 1083 1083 */ 1084 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3,0)1084 #if RTLNX_VER_MIN(3,3,0) 1085 1085 static int vbsf_inode_mkdir(struct inode *parent, struct dentry *dentry, umode_t mode) 1086 1086 #else … … 1203 1203 uint32_t fRename = (old_dentry->d_inode->i_mode & S_IFDIR ? SHFL_RENAME_DIR : SHFL_RENAME_FILE) 1204 1204 | SHFL_RENAME_REPLACE_IF_EXISTS; 1205 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15,0)1205 #if RTLNX_VER_MIN(3,15,0) 1206 1206 if (!(flags & ~RENAME_NOREPLACE)) { 1207 1207 if (flags & RENAME_NOREPLACE) … … 1273 1273 rc = -EXDEV; 1274 1274 } 1275 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15,0)1275 #if RTLNX_VER_MIN(3,15,0) 1276 1276 } else { 1277 1277 SFLOGFLOW(("vbsf_inode_rename: Unsupported flags: %#x\n", flags)); … … 1285 1285 1286 1286 1287 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9,0)1287 #if RTLNX_VER_MAX(4,9,0) 1288 1288 /** 1289 1289 * The traditional rename interface without any flags. … … 1373 1373 struct inode_operations vbsf_dir_iops = { 1374 1374 .lookup = vbsf_inode_lookup, 1375 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)1375 #if RTLNX_VER_MIN(3,16,0) 1376 1376 .atomic_open = vbsf_inode_atomic_open, 1377 1377 #endif … … 1381 1381 .rmdir = vbsf_inode_rmdir, 1382 1382 .unlink = vbsf_inode_unlink, 1383 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9,0)1383 #if RTLNX_VER_MIN(4,9,0) 1384 1384 .rename = vbsf_inode_rename, 1385 1385 #else 1386 1386 .rename = vbsf_inode_rename_no_flags, 1387 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15,0)1387 # if RTLNX_VER_MIN(3,15,0) 1388 1388 .rename2 = vbsf_inode_rename, 1389 1389 # endif 1390 1390 #endif 1391 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,18)1391 #if RTLNX_VER_MIN(2,5,18) 1392 1392 .getattr = vbsf_inode_getattr, 1393 1393 #else -
trunk/src/VBox/Additions/linux/sharedfolders/files_vboxsf
r82968 r85698 45 45 ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \ 46 46 ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \ 47 ${PATH_ROOT}/include/iprt/linux/version.h=>include/iprt/linux/version.h \ 47 48 ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \ 48 49 ${PATH_ROOT}/include/VBox/err.h=>include/VBox/err.h \ -
trunk/src/VBox/Additions/linux/sharedfolders/lnkops.c
r82968 r85698 108 108 } 109 109 110 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5,0)110 #if RTLNX_VER_MIN(4,5,0) 111 111 112 112 /** … … 147 147 #else /* < 4.5 */ 148 148 149 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,8)149 # if RTLNX_VER_MAX(2,6,8) 150 150 /** 151 151 * Reads the link into the given buffer. … … 183 183 * Follow link in dentry. 184 184 */ 185 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2,0)185 # if RTLNX_VER_MIN(4,2,0) 186 186 static const char *vbsf_follow_link(struct dentry *dentry, void **cookie) 187 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,13)187 # elif RTLNX_VER_MIN(2,6,13) 188 188 static void *vbsf_follow_link(struct dentry *dentry, struct nameidata *nd) 189 189 # else … … 213 213 */ 214 214 vbsf_dentry_chain_increase_ttl(dentry); 215 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2,0)215 # if RTLNX_VER_MIN(4,2,0) 216 216 *cookie = pszTarget; 217 217 return pszTarget; 218 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,8)218 # elif RTLNX_VER_MIN(2,6,8) 219 219 nd_set_link(nd, pszTarget); 220 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,13)220 # if RTLNX_VER_MIN(2,6,13) 221 221 return NULL; 222 222 # else … … 241 241 rc = -ENOMEM; 242 242 } 243 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2,0)243 # if RTLNX_VER_MIN(4,2,0) 244 244 *cookie = ERR_PTR(rc); 245 245 return (const char *)ERR_PTR(rc); 246 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,8)246 # elif RTLNX_VER_MIN(2,6,8) 247 247 nd_set_link(nd, (char *)ERR_PTR(rc)); 248 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,13)248 # if RTLNX_VER_MIN(2,6,13) 249 249 return NULL; 250 250 # else … … 256 256 } 257 257 258 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,8)258 # if RTLNX_VER_MIN(2,6,8) 259 259 /** 260 260 * For freeing target link buffer allocated by vbsf_follow_link. … … 262 262 * For kernels before 2.6.8 memory isn't being kept around. 263 263 */ 264 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2,0)264 # if RTLNX_VER_MIN(4,2,0) 265 265 static void vbsf_put_link(struct inode *inode, void *cookie) 266 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,13)266 # elif RTLNX_VER_MIN(2,6,13) 267 267 static void vbsf_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) 268 268 # else … … 270 270 # endif 271 271 { 272 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,13)272 # if RTLNX_VER_MIN(2,6,13) 273 273 char *page = cookie; 274 274 # else … … 287 287 */ 288 288 struct inode_operations vbsf_lnk_iops = { 289 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10,0)290 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,8)289 #if RTLNX_VER_MAX(4,10,0) 290 # if RTLNX_VER_MIN(2,6,8) 291 291 .readlink = generic_readlink, 292 292 # else … … 294 294 # endif 295 295 #endif 296 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5,0)296 #if RTLNX_VER_MIN(4,5,0) 297 297 .get_link = vbsf_get_link 298 298 #else 299 299 .follow_link = vbsf_follow_link, 300 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,8)300 # if RTLNX_VER_MIN(2,6,8) 301 301 .put_link = vbsf_put_link, 302 302 # endif -
trunk/src/VBox/Additions/linux/sharedfolders/regops.c
r85693 r85698 35 35 #include "vfsmod.h" 36 36 #include <linux/uio.h> 37 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,32)37 #if RTLNX_VER_MIN(2,5,32) 38 38 # include <linux/aio.h> /* struct kiocb before 4.1 */ 39 39 #endif 40 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,12)40 #if RTLNX_VER_MIN(2,5,12) 41 41 # include <linux/buffer_head.h> 42 42 #endif 43 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 12) \ 44 && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) 43 #if RTLNX_VER_RANGE(2,5,12, 2,6,31) 45 44 # include <linux/writeback.h> 46 45 #endif 47 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) \ 48 && LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) 46 #if RTLNX_VER_RANGE(2,6,23, 3,16,0) 49 47 # include <linux/splice.h> 50 48 #endif 51 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) \ 52 && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) 49 #if RTLNX_VER_RANGE(2,6,17, 2,6,23) 53 50 # include <linux/pipe_fs_i.h> 54 51 #endif 55 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,10)52 #if RTLNX_VER_MIN(2,4,10) 56 53 # include <linux/swap.h> /* for mark_page_accessed */ 57 54 #endif 58 55 #include <iprt/err.h> 59 56 60 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,18)57 #if RTLNX_VER_MAX(2,6,18) 61 58 # define SEEK_END 2 62 59 #endif 63 60 64 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16,0)61 #if RTLNX_VER_MAX(3,16,0) 65 62 # define iter_is_iovec(a_pIter) ( !((a_pIter)->type & ITER_KVEC) ) 66 #elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 19,0)63 #elif RTLNX_VER_MAX(3,19,0) 67 64 # define iter_is_iovec(a_pIter) ( !((a_pIter)->type & (ITER_KVEC | ITER_BVEC)) ) 68 65 #endif 69 66 70 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17,0)67 #if RTLNX_VER_MAX(4,17,0) 71 68 # define vm_fault_t int 72 69 #endif 73 70 74 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5,20)71 #if RTLNX_VER_MAX(2,5,20) 75 72 # define pgoff_t unsigned long 76 73 #endif 77 74 78 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5,12)75 #if RTLNX_VER_MAX(2,5,12) 79 76 # define PageUptodate(a_pPage) Page_Uptodate(a_pPage) 80 77 #endif … … 84 81 * Structures and Typedefs * 85 82 *********************************************************************************************************************************/ 86 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16,0)83 #if RTLNX_VER_MAX(3,16,0) 87 84 struct vbsf_iov_iter { 88 85 unsigned int type; … … 107 104 #endif 108 105 109 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,19)106 #if RTLNX_VER_MIN(2,6,19) 110 107 /** Used by vbsf_iter_lock_pages() to keep the first page of the next segment. */ 111 108 struct vbsf_iter_stash { … … 113 110 size_t off; 114 111 size_t cb; 115 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11,0)112 # if RTLNX_VER_MAX(4,11,0) 116 113 size_t offFromEnd; 117 114 struct iov_iter Copy; … … 120 117 #endif /* >= 3.16.0 */ 121 118 /** Initializer for struct vbsf_iter_stash. */ 122 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0)119 #if RTLNX_VER_MIN(4,11,0) 123 120 # define VBSF_ITER_STASH_INITIALIZER { NULL, 0 } 124 121 #else … … 140 137 * Provide more recent uio.h functionality to older kernels. * 141 138 *********************************************************************************************************************************/ 142 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)139 #if RTLNX_VER_RANGE(2,6,19, 3,16,0) 143 140 144 141 /** … … 299 296 300 297 #endif /* 2.6.19 <= linux < 3.16.0 */ 301 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 16,35)298 #if RTLNX_VER_RANGE(3,16,0, 3,16,35) 302 299 303 300 /** This is for implementing cMaxPage on 3.16 which doesn't have it. */ … … 319 316 320 317 #endif /* 3.16.0-3.16.34 */ 321 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 18,0)318 #if RTLNX_VER_RANGE(2,6,19, 3,18,0) 322 319 323 320 static size_t copy_from_iter(uint8_t *pbDst, size_t cbToCopy, struct iov_iter *pSrcIter) … … 325 322 size_t const cbTotal = cbToCopy; 326 323 Assert(iov_iter_count(pSrcIter) >= cbToCopy); 327 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)324 # if RTLNX_VER_MIN(3,16,0) 328 325 if (pSrcIter->type & ITER_BVEC) { 329 326 while (cbToCopy > 0) { … … 364 361 size_t const cbTotal = cbToCopy; 365 362 Assert(iov_iter_count(pDstIter) >= cbToCopy); 366 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)363 # if RTLNX_VER_MIN(3,16,0) 367 364 if (pDstIter->type & ITER_BVEC) { 368 365 while (cbToCopy > 0) { … … 555 552 *********************************************************************************************************************************/ 556 553 557 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,6)554 #if RTLNX_VER_MAX(2,6,6) 558 555 /** Any writable mappings? */ 559 556 DECLINLINE(bool) mapping_writably_mapped(struct address_space const *mapping) 560 557 { 561 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,6)558 # if RTLNX_VER_MIN(2,5,6) 562 559 return !list_empty(&mapping->i_mmap_shared); 563 560 # else … … 568 565 569 566 570 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5,12)567 #if RTLNX_VER_MAX(2,5,12) 571 568 /** Missing in 2.4.x, so just stub it for now. */ 572 569 DECLINLINE(bool) PageWriteback(struct page const *page) … … 604 601 *********************************************************************************************************************************/ 605 602 606 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) \ 607 && LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) 608 609 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) 603 #if RTLNX_VER_RANGE(2,6,17, 3,16,0) 604 605 # if RTLNX_VER_MAX(2,6,30) 610 606 # define LOCK_PIPE(a_pPipe) do { if ((a_pPipe)->inode) mutex_lock(&(a_pPipe)->inode->i_mutex); } while (0) 611 607 # define UNLOCK_PIPE(a_pPipe) do { if ((a_pPipe)->inode) mutex_unlock(&(a_pPipe)->inode->i_mutex); } while (0) … … 647 643 648 644 #endif 649 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) \ 650 && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) 645 #if RTLNX_VER_RANGE(2,6,17, 2,6,31) 651 646 652 647 /** Verify pipe buffer content (needed for page-cache to ensure idle page). */ … … 721 716 static struct pipe_buf_operations vbsf_pipe_buf_ops = { 722 717 .can_merge = 0, 723 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,23)718 # if RTLNX_VER_MIN(2,6,23) 724 719 .confirm = vbsf_pipe_buf_confirm, 725 720 # else … … 754 749 pPipeBuf->len = cbThisPage; 755 750 pPipeBuf->offset = offPg0; 756 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,23)751 # if RTLNX_VER_MIN(2,6,23) 757 752 pPipeBuf->private = 0; 758 753 # endif … … 895 890 896 891 #endif /* 2.6.17 <= LINUX_VERSION_CODE < 2.6.31 */ 897 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) \ 898 && LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) 892 #if RTLNX_VER_RANGE(2,6,17, 3,16,0) 899 893 900 894 /** … … 1017 1011 pPipeBuf = &pPipe->bufs[pPipe->curbuf]; 1018 1012 1019 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,30)1013 # if RTLNX_VER_MAX(2,6,30) 1020 1014 fNeedWakeUp |= pPipe->inode != NULL; 1021 1015 # else … … 1092 1086 #endif /* 2.6.17 <= LINUX_VERSION_CODE < 3.16.0 */ 1093 1087 1094 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 30) \ 1095 && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) 1088 #if RTLNX_VER_RANGE(2,5,30, 2,6,23) 1096 1089 /** 1097 1090 * Our own senfile implementation that does not go via the page cache like … … 1099 1092 */ 1100 1093 static ssize_t vbsf_reg_sendfile(struct file *pFile, loff_t *poffFile, size_t cbToSend, read_actor_t pfnActor, 1101 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,8)1094 # if RTLNX_VER_MIN(2,6,8) 1102 1095 void *pvUser 1103 1096 # else … … 1161 1154 read_descriptor_t RdDesc; 1162 1155 RdDesc.count = cbToSend; 1163 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,8)1156 # if RTLNX_VER_MIN(2,6,8) 1164 1157 RdDesc.arg.data = pvUser; 1165 1158 # else … … 1290 1283 DECLINLINE(void) vbsf_put_page(struct page *pPage) 1291 1284 { 1292 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6,0)1285 #if RTLNX_VER_MIN(4,6,0) 1293 1286 put_page(pPage); 1294 1287 #else … … 1301 1294 DECLINLINE(void) vbsf_get_page(struct page *pPage) 1302 1295 { 1303 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6,0)1296 #if RTLNX_VER_MIN(4,6,0) 1304 1297 get_page(pPage); 1305 1298 #else … … 1409 1402 * Check that this is valid user memory that is actually in the kernel range. 1410 1403 */ 1411 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0,0) || defined(RHEL_81)1404 #if RTLNX_VER_MIN(5,0,0) || defined(RHEL_81) 1412 1405 if ( access_ok((void *)uPtrFrom, cPages << PAGE_SHIFT) 1413 1406 && uPtrFrom >= USER_DS.seg) … … 1476 1469 static ssize_t vbsf_reg_read_mapped(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off) 1477 1470 { 1478 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)1471 #if RTLNX_VER_MIN(3,16,0) 1479 1472 struct iovec iov = { .iov_base = buf, .iov_len = size }; 1480 1473 struct iov_iter iter; … … 1491 1484 return cbRet; 1492 1485 1493 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,19)1486 #elif RTLNX_VER_MIN(2,6,19) 1494 1487 struct iovec iov = { .iov_base = buf, .iov_len = size }; 1495 1488 struct kiocb kiocb; … … 1778 1771 if (cbToCopy == PAGE_SIZE) 1779 1772 SetPageUptodate(pDstPage); 1780 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,10)1773 # if RTLNX_VER_MIN(2,4,10) 1781 1774 mark_page_accessed(pDstPage); 1782 1775 # endif … … 1987 1980 && mapping->nrpages > 0 1988 1981 && mapping_writably_mapped(mapping)) { 1989 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,32)1982 #if RTLNX_VER_MIN(2,6,32) 1990 1983 int err = filemap_fdatawait_range(mapping, pos, pos + size - 1); 1991 1984 if (err) … … 2079 2072 } 2080 2073 2081 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,19)2074 #if RTLNX_VER_MIN(2,6,19) 2082 2075 2083 2076 /** … … 2147 2140 SFLOG3(("vbsf_iter_lock_pages: Picked up stashed page: %#zx LB %#zx\n", offPage0, cbChunk)); 2148 2141 } else { 2149 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11,0)2142 # if RTLNX_VER_MAX(4,11,0) 2150 2143 /* 2151 2144 * Copy out our starting point to assist rewinding. … … 2166 2159 ssize_t cbSegRet; 2167 2160 if (cPages == 0) { 2168 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19,0)2161 # if RTLNX_VER_MAX(3,19,0) 2169 2162 while (!iov_iter_single_seg_count(iter)) /* Old code didn't skip empty segments which caused EFAULTs. */ 2170 2163 iov_iter_advance(iter, 0); … … 2259 2252 * and vbsf_lock_user_pages_failed_check_kernel() as well. 2260 2253 */ 2261 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11,0)2254 # if RTLNX_VER_MAX(4,11,0) 2262 2255 pStash->offFromEnd = iov_iter_count(iter); 2263 2256 pStash->Copy = *iter; … … 2274 2267 } 2275 2268 2276 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19,0)2269 # if RTLNX_VER_MIN(3,19,0) 2277 2270 pbBuf = iter->kvec->iov_base + iter->iov_offset; 2278 2271 # else … … 2339 2332 } 2340 2333 2341 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) || LINUX_VERSION_CODE < KERNEL_VERSION(3, 16,0)2334 # if RTLNX_VER_MIN(4,11,0) || RTLNX_VER_MAX(3,16,0) 2342 2335 iov_iter_revert(iter, cbToRewind + cbExtra); 2343 2336 return true; … … 2369 2362 { 2370 2363 size_t cPages; 2371 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)2364 # if RTLNX_VER_MIN(3,16,0) 2372 2365 if (iter_is_iovec(iter) || (iter->type & ITER_KVEC)) { 2373 2366 #endif … … 2429 2422 if (cPagesSpan > cPages) 2430 2423 cPages = cPagesSpan; 2431 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)2424 # if RTLNX_VER_MIN(3,16,0) 2432 2425 } else { 2433 2426 /* Won't bother with accurate counts for the next two types, just make … … 2568 2561 * @param iter The I/O vector iterator describing the buffer. 2569 2562 */ 2570 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)2563 # if RTLNX_VER_MIN(3,16,0) 2571 2564 static ssize_t vbsf_reg_read_iter(struct kiocb *kio, struct iov_iter *iter) 2572 2565 # else … … 2574 2567 # endif 2575 2568 { 2576 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16,0)2569 # if RTLNX_VER_MAX(3,16,0) 2577 2570 struct vbsf_iov_iter fake_iter = VBSF_IOV_ITER_INITIALIZER(cSegs, iov, 0 /*write*/); 2578 2571 struct vbsf_iov_iter *iter = &fake_iter; … … 2602 2595 */ 2603 2596 if (vbsf_should_use_cached_read(kio->ki_filp, mapping, pSuperInfo)) { 2604 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)2597 # if RTLNX_VER_MIN(3,16,0) 2605 2598 return generic_file_read_iter(kio, iter); 2606 2599 # else … … 2794 2787 * @param iter The I/O vector iterator describing the buffer. 2795 2788 */ 2796 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)2789 # if RTLNX_VER_MIN(3,16,0) 2797 2790 static ssize_t vbsf_reg_write_iter(struct kiocb *kio, struct iov_iter *iter) 2798 2791 # else … … 2800 2793 # endif 2801 2794 { 2802 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16,0)2795 # if RTLNX_VER_MAX(3,16,0) 2803 2796 struct vbsf_iov_iter fake_iter = VBSF_IOV_ITER_INITIALIZER(cSegs, iov, 1 /*write*/); 2804 2797 struct vbsf_iov_iter *iter = &fake_iter; … … 2811 2804 struct vbsf_reg_info *sf_r = kio->ki_filp->private_data; 2812 2805 struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb); 2813 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)2806 # if RTLNX_VER_MIN(3,16,0) 2814 2807 loff_t offFile = kio->ki_pos; 2815 2808 # endif 2816 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1,0)2809 # if RTLNX_VER_MIN(4,1,0) 2817 2810 bool const fAppend = RT_BOOL(kio->ki_flags & IOCB_APPEND); 2818 2811 # else … … 2854 2847 && mapping->nrpages > 0 2855 2848 && mapping_writably_mapped(mapping)) { 2856 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,32)2849 # if RTLNX_VER_MIN(2,6,32) 2857 2850 int err = filemap_fdatawait_range(mapping, offFile, offFile + cbToWrite - 1); 2858 2851 if (err) … … 2890 2883 i_size_write(inode, offFile); 2891 2884 2892 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0)2885 # if RTLNX_VER_MIN(4,11,0) 2893 2886 if ((size_t)cbRet < cbToWrite) 2894 2887 iov_iter_revert(iter, cbToWrite - cbRet); … … 3129 3122 && mapping->nrpages > 0 3130 3123 /** @todo && last writable handle */ ) { 3131 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,25)3124 #if RTLNX_VER_MIN(2,4,25) 3132 3125 if (filemap_fdatawrite(mapping) != -EIO) 3133 3126 #else … … 3176 3169 } 3177 3170 3178 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,8)3171 #if RTLNX_VER_MIN(2,4,8) 3179 3172 return generic_file_llseek(file, off, whence); 3180 3173 #else … … 3192 3185 * well as any host interaction with the file. 3193 3186 */ 3194 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1,0) \3195 || (defined(CONFIG_SUSE_KERNEL) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0,101) /** @todo figure when exactly */)3187 #if RTLNX_VER_MIN(3,1,0) \ 3188 || (defined(CONFIG_SUSE_KERNEL) && RTLNX_VER_MIN(3,0,101) /** @todo figure when exactly */) 3196 3189 static int vbsf_reg_fsync(struct file *file, loff_t start, loff_t end, int datasync) 3197 3190 { 3198 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)3191 # if RTLNX_VER_MIN(3,16,0) 3199 3192 return __generic_file_fsync(file, start, end, datasync); 3200 3193 # else … … 3202 3195 # endif 3203 3196 } 3204 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,35)3197 #elif RTLNX_VER_MIN(2,6,35) 3205 3198 static int vbsf_reg_fsync(struct file *file, int datasync) 3206 3199 { … … 3210 3203 static int vbsf_reg_fsync(struct file *file, struct dentry *dentry, int datasync) 3211 3204 { 3212 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,31)3205 # if RTLNX_VER_MIN(2,6,31) 3213 3206 return simple_fsync(file, dentry, datasync); 3214 3207 # else … … 3219 3212 /** @todo What about file_fsync()? (<= 2.5.11) */ 3220 3213 3221 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,12)3214 # if RTLNX_VER_MIN(2,5,12) 3222 3215 rc = sync_mapping_buffers(inode->i_mapping); 3223 3216 if ( rc == 0 … … 3240 3233 */ 3241 3234 rc = fsync_inode_buffers(inode); 3242 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,10)3235 # if RTLNX_VER_MIN(2,4,10) 3243 3236 if (rc == 0 && datasync) 3244 3237 rc = fsync_inode_data_buffers(inode); … … 3252 3245 3253 3246 3254 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5,0)3247 #if RTLNX_VER_MIN(4,5,0) 3255 3248 /** 3256 3249 * Copy a datablock from one file to another on the host side. … … 3279 3272 Assert(pInodeInfoDst->u32Magic == SF_INODE_INFO_MAGIC); 3280 3273 3281 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11,0)3274 # if RTLNX_VER_MAX(4,11,0) 3282 3275 if (!S_ISREG(pInodeSrc->i_mode) || !S_ISREG(pInodeDst->i_mode)) 3283 3276 return S_ISDIR(pInodeSrc->i_mode) || S_ISDIR(pInodeDst->i_mode) ? -EISDIR : -EINVAL; … … 3323 3316 3324 3317 /* Generic page fault callback: */ 3325 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0)3318 # if RTLNX_VER_MIN(4,11,0) 3326 3319 static vm_fault_t vbsf_vmlog_fault(struct vm_fault *vmf) 3327 3320 { … … 3332 3325 return rc; 3333 3326 } 3334 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,23)3327 # elif RTLNX_VER_MIN(2,6,23) 3335 3328 static int vbsf_vmlog_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 3336 3329 { 3337 3330 int rc; 3338 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10,0)3331 # if RTLNX_VER_MIN(4,10,0) 3339 3332 SFLOGFLOW(("vbsf_vmlog_fault: vma=%p vmf=%p flags=%#x addr=%p\n", vma, vmf, vmf->flags, vmf->address)); 3340 3333 # else … … 3349 3342 3350 3343 /* Special/generic page fault handler: */ 3351 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,26)3352 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,1)3344 # if RTLNX_VER_MIN(2,6,26) 3345 # elif RTLNX_VER_MIN(2,6,1) 3353 3346 static struct page *vbsf_vmlog_nopage(struct vm_area_struct *vma, unsigned long address, int *type) 3354 3347 { … … 3372 3365 3373 3366 /* Special page fault callback for making something writable: */ 3374 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0)3367 # if RTLNX_VER_MIN(4,11,0) 3375 3368 static vm_fault_t vbsf_vmlog_page_mkwrite(struct vm_fault *vmf) 3376 3369 { … … 3381 3374 return rc; 3382 3375 } 3383 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,30)3376 # elif RTLNX_VER_MIN(2,6,30) 3384 3377 static int vbsf_vmlog_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) 3385 3378 { 3386 3379 int rc; 3387 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10,0)3380 # if RTLNX_VER_MIN(4,10,0) 3388 3381 SFLOGFLOW(("vbsf_vmlog_page_mkwrite: vma=%p vmf=%p flags=%#x addr=%p\n", vma, vmf, vmf->flags, vmf->address)); 3389 3382 # else … … 3394 3387 return rc; 3395 3388 } 3396 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,18)3389 # elif RTLNX_VER_MIN(2,6,18) 3397 3390 static int vbsf_vmlog_page_mkwrite(struct vm_area_struct *vma, struct page *page) 3398 3391 { … … 3407 3400 3408 3401 /* Special page fault callback for mapping pages: */ 3409 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10,0)3402 # if RTLNX_VER_MIN(4,10,0) 3410 3403 static void vbsf_vmlog_map_pages(struct vm_fault *vmf, pgoff_t start, pgoff_t end) 3411 3404 { … … 3414 3407 SFLOGFLOW(("vbsf_vmlog_map_pages: returns\n")); 3415 3408 } 3416 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8,0)3409 # elif RTLNX_VER_MIN(4,8,0) 3417 3410 static void vbsf_vmlog_map_pages(struct fault_env *fenv, pgoff_t start, pgoff_t end) 3418 3411 { … … 3421 3414 SFLOGFLOW(("vbsf_vmlog_map_pages: returns\n")); 3422 3415 } 3423 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15,0)3416 # elif RTLNX_VER_MIN(3,15,0) 3424 3417 static void vbsf_vmlog_map_pages(struct vm_area_struct *vma, struct vm_fault *vmf) 3425 3418 { … … 3433 3426 /** Overload template. */ 3434 3427 static struct vm_operations_struct const g_LoggingVmOpsTemplate = { 3435 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,23)3428 # if RTLNX_VER_MIN(2,6,23) 3436 3429 .fault = vbsf_vmlog_fault, 3437 3430 # endif 3438 # if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 25)3431 # if RTLNX_VER_MAX(2,6,26) 3439 3432 .nopage = vbsf_vmlog_nopage, 3440 3433 # endif 3441 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,18)3434 # if RTLNX_VER_MIN(2,6,18) 3442 3435 .page_mkwrite = vbsf_vmlog_page_mkwrite, 3443 3436 # endif 3444 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15,0)3437 # if RTLNX_VER_MIN(3,15,0) 3445 3438 .map_pages = vbsf_vmlog_map_pages, 3446 3439 # endif … … 3499 3492 .read = vbsf_reg_read, 3500 3493 .write = vbsf_reg_write, 3501 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)3494 #if RTLNX_VER_MIN(3,16,0) 3502 3495 .read_iter = vbsf_reg_read_iter, 3503 3496 .write_iter = vbsf_reg_write_iter, 3504 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,19)3497 #elif RTLNX_VER_MIN(2,6,19) 3505 3498 .aio_read = vbsf_reg_aio_read, 3506 3499 .aio_write = vbsf_reg_aio_write, … … 3512 3505 .mmap = generic_file_mmap, 3513 3506 #endif 3514 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,31)3507 #if RTLNX_VER_RANGE(2,6,17, 2,6,31) 3515 3508 .splice_read = vbsf_splice_read, 3516 3509 #endif 3517 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0)3510 #if RTLNX_VER_MIN(3,16,0) 3518 3511 .splice_write = iter_file_splice_write, 3519 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,17)3512 #elif RTLNX_VER_MIN(2,6,17) 3520 3513 .splice_write = vbsf_splice_write, 3521 3514 #endif 3522 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 30) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,23)3515 #if RTLNX_VER_RANGE(2,5,30, 2,6,23) 3523 3516 .sendfile = vbsf_reg_sendfile, 3524 3517 #endif 3525 3518 .llseek = vbsf_reg_llseek, 3526 3519 .fsync = vbsf_reg_fsync, 3527 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5,0)3520 #if RTLNX_VER_MIN(4,5,0) 3528 3521 .copy_file_range = vbsf_reg_copy_file_range, 3529 3522 #endif … … 3535 3528 */ 3536 3529 struct inode_operations vbsf_reg_iops = { 3537 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,18)3530 #if RTLNX_VER_MIN(2,5,18) 3538 3531 .getattr = vbsf_inode_getattr, 3539 3532 #else … … 3621 3614 * fashion. 3622 3615 */ 3623 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,52)3616 #if RTLNX_VER_MIN(2,5,52) 3624 3617 static int vbsf_writepage(struct page *page, struct writeback_control *wbc) 3625 3618 #else … … 3698 3691 3699 3692 3700 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,24)3693 #if RTLNX_VER_MIN(2,6,24) 3701 3694 /** 3702 3695 * Called when writing thru the page cache (which we shouldn't be doing). … … 3724 3717 3725 3718 3726 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,10)3719 #if RTLNX_VER_MIN(2,4,10) 3727 3720 3728 3721 # ifdef VBOX_UEK … … 3774 3767 .writepage = vbsf_writepage, 3775 3768 /** @todo Need .writepages if we want msync performance... */ 3776 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,12)3769 #if RTLNX_VER_MIN(2,5,12) 3777 3770 .set_page_dirty = __set_page_dirty_buffers, 3778 3771 #endif 3779 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,24)3772 #if RTLNX_VER_MIN(2,6,24) 3780 3773 .write_begin = vbsf_write_begin, 3781 3774 .write_end = simple_write_end, 3782 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,45)3775 #elif RTLNX_VER_MIN(2,5,45) 3783 3776 .prepare_write = simple_prepare_write, 3784 3777 .commit_write = simple_commit_write, 3785 3778 #endif 3786 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,10)3779 #if RTLNX_VER_MIN(2,4,10) 3787 3780 .direct_IO = vbsf_direct_IO, 3788 3781 #endif -
trunk/src/VBox/Additions/linux/sharedfolders/utils.c
r82968 r85698 51 51 52 52 while (in_bound_len) { 53 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,31)53 #if RTLNX_VER_MIN(2,6,31) 54 54 unicode_t uni; 55 55 int cbInEnc = utf8_to_utf32(in, in_bound_len, &uni); … … 112 112 if (cbNlsCodepoint >= 0) { 113 113 char achTmp[16]; 114 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,31)114 #if RTLNX_VER_MIN(2,6,31) 115 115 int cbUtf8Codepoint = utf32_to_utf8(uc, achTmp, sizeof(achTmp)); 116 116 #else … … 145 145 int const cbNlsCodepoint = pSuperInfo->nls->char2uni(&pszNls[offNls], cchNls - offNls, &uc); 146 146 if (cbNlsCodepoint >= 0) { 147 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,31)147 #if RTLNX_VER_MIN(2,6,31) 148 148 int cbUtf8Codepoint = utf32_to_utf8(uc, pchDst, cchUtf8); 149 149 #else … … 215 215 * Convert from VBox to linux time. 216 216 */ 217 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,0)217 #if RTLNX_VER_MAX(2,6,0) 218 218 DECLINLINE(void) vbsf_time_to_linux(time_t *pLinuxDst, PCRTTIMESPEC pVBoxSrc) 219 219 { … … 223 223 } 224 224 #else /* >= 2.6.0 */ 225 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18,0)225 # if RTLNX_VER_MAX(4,18,0) 226 226 DECLINLINE(void) vbsf_time_to_linux(struct timespec *pLinuxDst, PCRTTIMESPEC pVBoxSrc) 227 227 # else … … 239 239 * Convert from linux to VBox time. 240 240 */ 241 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,0)241 #if RTLNX_VER_MAX(2,6,0) 242 242 DECLINLINE(void) vbsf_time_to_vbox(PRTTIMESPEC pVBoxDst, time_t *pLinuxSrc) 243 243 { … … 245 245 } 246 246 #else /* >= 2.6.0 */ 247 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18,0)247 # if RTLNX_VER_MAX(4,18,0) 248 248 DECLINLINE(void) vbsf_time_to_vbox(PRTTIMESPEC pVBoxDst, struct timespec const *pLinuxSrc) 249 249 # else … … 327 327 inode->i_fop = &vbsf_reg_fops; 328 328 inode->i_mapping->a_ops = &vbsf_reg_aops; 329 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 17) \ 330 && LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) 329 #if RTLNX_VER_RANGE(2,5,17, 4,0,0) 331 330 inode->i_mapping->backing_dev_info = &pSuperInfo->bdi; /* This is needed for mmap. */ 332 331 #endif … … 334 333 } 335 334 336 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5,0)335 #if RTLNX_VER_MIN(3,5,0) 337 336 inode->i_uid = make_kuid(current_user_ns(), pSuperInfo->uid); 338 337 inode->i_gid = make_kgid(current_user_ns(), pSuperInfo->gid); … … 343 342 344 343 inode->i_size = pObjInfo->cbObject; 345 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,19) && !defined(KERNEL_FC6)344 #if RTLNX_VER_MAX(2,6,19) && !defined(KERNEL_FC6) 346 345 inode->i_blksize = 4096; 347 346 #endif 348 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,11)347 #if RTLNX_VER_MIN(2,4,11) 349 348 inode->i_blkbits = 12; 350 349 #endif … … 374 373 TRACE(); 375 374 376 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5,0)375 #if RTLNX_VER_MIN(4,5,0) 377 376 if (!fInodeLocked) 378 377 inode_lock(pInode); … … 402 401 vbsf_init_inode(pInode, pInodeInfo, pObjInfo, pSuperInfo); 403 402 404 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5,0)403 #if RTLNX_VER_MIN(4,5,0) 405 404 if (!fInodeLocked) 406 405 inode_unlock(pInode); … … 467 466 if (mapping && mapping->nrpages > 0) { 468 467 SFLOGFLOW(("vbsf_update_inode: Invalidating the mapping %s (%#x)\n", pInodeInfo->path->String.ach, fSetAttrs)); 469 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,34)468 #if RTLNX_VER_MIN(2,6,34) 470 469 invalidate_mapping_pages(mapping, 0, ~(pgoff_t)0); 471 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,41)470 #elif RTLNX_VER_MIN(2,5,41) 472 471 invalidate_inode_pages(mapping); 473 472 #else … … 487 486 * Done. 488 487 */ 489 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5,0)488 #if RTLNX_VER_MIN(4,5,0) 490 489 if (!fInodeLocked) 491 490 inode_unlock(pInode); … … 627 626 628 627 629 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5,18)628 #if RTLNX_VER_MAX(2,5,18) 630 629 /** 631 630 * Revalidate an inode for 2.4. … … 700 699 has inode at all) from these new attributes we derive [kstat] via 701 700 [generic_fillattr] */ 702 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,18)703 704 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0)701 #if RTLNX_VER_MIN(2,5,18) 702 703 # if RTLNX_VER_MIN(4,11,0) 705 704 int vbsf_inode_getattr(const struct path *path, struct kstat *kstat, u32 request_mask, unsigned int flags) 706 705 # else … … 709 708 { 710 709 int rc; 711 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0)710 # if RTLNX_VER_MIN(4,11,0) 712 711 struct dentry *dentry = path->dentry; 713 712 # endif 714 713 715 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0)714 # if RTLNX_VER_MIN(4,11,0) 716 715 SFLOGFLOW(("vbsf_inode_getattr: dentry=%p request_mask=%#x flags=%#x\n", dentry, request_mask, flags)); 717 716 # else … … 719 718 # endif 720 719 721 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0)720 # if RTLNX_VER_MIN(4,11,0) 722 721 /* 723 722 * With the introduction of statx() userland can control whether we … … 745 744 746 745 /* Add birth time. */ 747 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0)746 # if RTLNX_VER_MIN(4,11,0) 748 747 if (dentry->d_inode) { 749 748 struct vbsf_inode_info *pInodeInfo = VBSF_GET_INODE_INFO(dentry->d_inode); … … 807 806 */ 808 807 iattr->ia_valid |= ATTR_FORCE; 809 #if ( LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 39) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)) || LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) || (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 37) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 2,0))808 #if (RTLNX_VER_RANGE(3,16,39, 3,17,0)) || RTLNX_VER_MIN(4,9,0) || (RTLNX_VER_RANGE(4,1,37, 4,2,0)) 810 809 rc = setattr_prepare(dentry, iattr); 811 810 #else … … 818 817 */ 819 818 unsigned fAttrs = iattr->ia_valid; 820 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,15)819 #if RTLNX_VER_MIN(2,6,15) 821 820 fAttrs &= ~ATTR_FILE; 822 821 #endif 823 822 if ( fAttrs == (ATTR_SIZE | ATTR_MTIME | ATTR_CTIME) 824 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,24)823 #if RTLNX_VER_MIN(2,6,24) 825 824 || (fAttrs & (ATTR_OPEN | ATTR_SIZE)) == (ATTR_OPEN | ATTR_SIZE) 826 825 #endif … … 1067 1066 in += nb; 1068 1067 1069 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,31)1068 #if RTLNX_VER_MIN(2,6,31) 1070 1069 nb = utf32_to_utf8(uni, out, out_bound_len); 1071 1070 #else … … 1113 1112 * @note Caller holds no relevant locks, just a dentry reference. 1114 1113 */ 1115 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6,0)1114 #if RTLNX_VER_MIN(3,6,0) 1116 1115 static int vbsf_dentry_revalidate(struct dentry *dentry, unsigned flags) 1117 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0)1116 #elif RTLNX_VER_MIN(2,6,0) 1118 1117 static int vbsf_dentry_revalidate(struct dentry *dentry, struct nameidata *nd) 1119 1118 #else … … 1121 1120 #endif 1122 1121 { 1123 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 6,0)1122 #if RTLNX_VER_RANGE(2,6,0, 3,6,0) 1124 1123 int const flags = nd ? nd->flags : 0; 1125 1124 #endif … … 1139 1138 * 1140 1139 */ 1141 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,38)1140 #if RTLNX_VER_MIN(2,6,38) 1142 1141 if (flags & LOOKUP_RCU) { 1143 1142 rc = -ECHILD; … … 1181 1180 * later point). 1182 1181 */ 1183 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,28)1182 #if RTLNX_VER_MIN(2,6,28) 1184 1183 if (flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET)) 1185 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,75)1184 #elif RTLNX_VER_MIN(2,5,75) 1186 1185 if (flags & LOOKUP_CREATE) 1187 1186 #else … … 1214 1213 1215 1214 /** For logging purposes only. */ 1216 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,38)1215 # if RTLNX_VER_MIN(2,6,38) 1217 1216 static int vbsf_dentry_delete(const struct dentry *pDirEntry) 1218 1217 # else … … 1224 1223 } 1225 1224 1226 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8,0)1225 # if RTLNX_VER_MIN(4,8,0) 1227 1226 /** For logging purposes only. */ 1228 1227 static int vbsf_dentry_init(struct dentry *pDirEntry) … … 1244 1243 #ifdef SFLOG_ENABLED 1245 1244 .d_delete = vbsf_dentry_delete, 1246 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8,0)1245 # if RTLNX_VER_MIN(4,8,0) 1247 1246 .d_init = vbsf_dentry_init, 1248 1247 # endif -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c
r85432 r85698 46 46 #include "revision-generated.h" 47 47 #include "product-generated.h" 48 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0,0)48 #if RTLNX_VER_MIN(5,0,0) 49 49 # include <uapi/linux/mount.h> /* for MS_REMOUNT */ 50 #elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 3,0)50 #elif RTLNX_VER_MAX(3,3,0) 51 51 # include <linux/mount.h> 52 52 #endif 53 53 #include <linux/seq_file.h> 54 54 #include <linux/vfs.h> 55 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 62) && LINUX_VERSION_CODE < KERNEL_VERSION(5, 8,0)55 #if RTLNX_VER_RANGE(2,5,62, 5,8,0) 56 56 # include <linux/vermagic.h> 57 57 #endif … … 356 356 { 357 357 int rc = 0; 358 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0)358 #if RTLNX_VER_MIN(2,6,0) 359 359 /* Each new shared folder map gets a new uint64_t identifier, 360 360 * allocated in sequence. We ASSUME the sequence will not wrap. */ 361 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,26)361 # if RTLNX_VER_MIN(2,6,26) 362 362 static uint64_t s_u64Sequence = 0; 363 363 uint64_t idSeqMine = ASMAtomicIncU64(&s_u64Sequence); … … 365 365 struct backing_dev_info *bdi; 366 366 367 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 2,0)367 # if RTLNX_VER_RANGE(4,0,0, 4,2,0) 368 368 pSuperInfo->bdi_org = sb->s_bdi; 369 369 # endif 370 370 371 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12,0)371 # if RTLNX_VER_MIN(4,12,0) 372 372 rc = super_setup_bdi_name(sb, "vboxsf-%llu", (unsigned long long)idSeqMine); 373 373 if (!rc) … … 381 381 bdi->ra_pages = 0; /* No readahead */ 382 382 383 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,12)383 # if RTLNX_VER_MIN(2,6,12) 384 384 bdi->capabilities = 0 385 385 # ifdef BDI_CAP_MAP_DIRECT … … 399 399 # endif 400 400 # ifdef BDI_CAP_STRICTLIMIT 401 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19,0) /* Trouble with 3.16.x/debian8. Process stops after dirty page throttling.401 # if RTLNX_VER_MIN(4,19,0) /* Trouble with 3.16.x/debian8. Process stops after dirty page throttling. 402 402 * Only tested successfully with 4.19. Maybe skip altogether? */ 403 403 | BDI_CAP_STRICTLIMIT; … … 414 414 # endif /* >= 2.6.12 */ 415 415 416 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 12,0)416 # if RTLNX_VER_RANGE(2,6,24, 4,12,0) 417 417 rc = bdi_init(&pSuperInfo->bdi); 418 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,26)418 # if RTLNX_VER_MIN(2,6,26) 419 419 if (!rc) 420 420 rc = bdi_register(&pSuperInfo->bdi, NULL, "vboxsf-%llu", (unsigned long long)idSeqMine); … … 422 422 # endif /* 4.11.0 > version >= 2.6.24 */ 423 423 424 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 12,0)424 # if RTLNX_VER_RANGE(2,6,34, 4,12,0) 425 425 if (!rc) 426 426 sb->s_bdi = bdi; … … 437 437 static void vbsf_done_backing_dev(struct super_block *sb, struct vbsf_super_info *pSuperInfo) 438 438 { 439 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) && LINUX_VERSION_CODE <= KERNEL_VERSION(4, 12,0)439 #if RTLNX_VER_RANGE(2,6,24, 4,13,0) 440 440 bdi_destroy(&pSuperInfo->bdi); /* includes bdi_unregister() */ 441 441 442 442 /* Paranoia: Make sb->s_bdi not point at pSuperInfo->bdi, in case someone 443 443 trouches it after this point (we may screw up something). */ 444 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 2,0)444 # if RTLNX_VER_RANGE(4,0,0, 4,2,0) 445 445 sb->s_bdi = pSuperInfo->bdi_org; /* (noop_backing_dev_info is not exported) */ 446 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 10,0)446 # elif RTLNX_VER_RANGE(2,6,34, 4,10,0) 447 447 sb->s_bdi = &noop_backing_dev_info; 448 448 # endif … … 491 491 * Note! ls -la does display '.' and '..' entries with st_ino == 0, so root is #1. 492 492 */ 493 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,25)493 #if RTLNX_VER_MIN(2,4,25) 494 494 struct inode *iroot = iget_locked(sb, 1); 495 495 #else … … 500 500 VBSF_SET_INODE_INFO(iroot, sf_i); 501 501 502 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,25)502 #if RTLNX_VER_MIN(2,4,25) 503 503 unlock_new_inode(iroot); 504 504 #endif … … 507 507 * Now make it a root inode. 508 508 */ 509 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4,0)509 #if RTLNX_VER_MIN(3,4,0) 510 510 sb->s_root = d_make_root(iroot); 511 511 #else … … 518 518 519 519 SFLOGRELBOTH(("vboxsf: d_make_root failed!\n")); 520 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4,0) /* d_make_root calls iput */520 #if RTLNX_VER_MAX(3,4,0) /* d_make_root calls iput */ 521 521 iput(iroot); 522 522 #endif … … 582 582 sb->s_magic = 0xface; 583 583 sb->s_blocksize = 1024; 584 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,3)584 #if RTLNX_VER_MIN(2,4,3) 585 585 /* Required for seek/sendfile (see 'loff_t max' in fs/read_write.c / do_sendfile()). */ 586 586 # if defined MAX_LFS_FILESIZE … … 592 592 # endif 593 593 #endif 594 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,11)594 #if RTLNX_VER_MIN(2,6,11) 595 595 sb->s_time_gran = 1; /* This might be a little optimistic for windows hosts, where it should be 100. */ 596 596 #endif 597 597 sb->s_op = &g_vbsf_super_ops; 598 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,38)598 #if RTLNX_VER_MIN(2,6,38) 599 599 sb->s_d_op = &vbsf_dentry_ops; 600 600 #endif … … 629 629 * We must free the inode info structure here. 630 630 */ 631 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,36)631 #if RTLNX_VER_MIN(2,6,36) 632 632 static void vbsf_evict_inode(struct inode *inode) 633 633 #else … … 642 642 * Flush stuff. 643 643 */ 644 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,36)644 #if RTLNX_VER_MIN(2,6,36) 645 645 truncate_inode_pages(&inode->i_data, 0); 646 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5,0)646 # if RTLNX_VER_MIN(3,5,0) 647 647 clear_inode(inode); 648 648 # else … … 673 673 hence we can't do anything here, and let lookup/whatever with the 674 674 job to properly fill then [inode] */ 675 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,25)675 #if RTLNX_VER_MAX(2,6,25) 676 676 static void vbsf_read_inode(struct inode *inode) 677 677 { … … 696 696 * Get file system statistics. 697 697 */ 698 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,18)698 #if RTLNX_VER_MIN(2,6,18) 699 699 static int vbsf_statfs(struct dentry *dentry, struct kstatfs *stat) 700 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,73)700 #elif RTLNX_VER_MIN(2,5,73) 701 701 static int vbsf_statfs(struct super_block *sb, struct kstatfs *stat) 702 702 #else … … 704 704 #endif 705 705 { 706 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,18)706 #if RTLNX_VER_MIN(2,6,18) 707 707 struct super_block *sb = dentry->d_inode->i_sb; 708 708 #endif … … 716 716 stat->f_type = UINT32_C(0x786f4256); /* 'VBox' little endian */ 717 717 stat->f_bsize = pVolInfo->ulBytesPerAllocationUnit; 718 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,73)718 #if RTLNX_VER_MIN(2,5,73) 719 719 stat->f_frsize = pVolInfo->ulBytesPerAllocationUnit; 720 720 #endif … … 731 731 stat->f_fsid.val[1] = 0; 732 732 stat->f_namelen = 255; 733 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,36)733 #if RTLNX_VER_MIN(2,6,36) 734 734 stat->f_flags = 0; /* not valid */ 735 735 #endif … … 746 746 static int vbsf_remount_fs(struct super_block *sb, int *flags, char *data) 747 747 { 748 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,23)748 #if RTLNX_VER_MIN(2,4,23) 749 749 struct vbsf_super_info *pSuperInfo = pSuperInfo = VBSF_GET_SUPER_INFO(sb); 750 750 struct vbsf_inode_info *sf_i; … … 774 774 /*unlock_new_inode(iroot); */ 775 775 return 0; 776 #else /* LINUX_VERSION_CODE< 2.4.23 */776 #else /* < 2.4.23 */ 777 777 return -ENOSYS; 778 #endif /* LINUX_VERSION_CODE< 2.4.23 */778 #endif /* < 2.4.23 */ 779 779 } 780 780 … … 786 786 * the the 'szTag' option value it sets on its mount. 787 787 */ 788 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3,0)788 #if RTLNX_VER_MAX(3,3,0) 789 789 static int vbsf_show_options(struct seq_file *m, struct vfsmount *mnt) 790 790 #else … … 792 792 #endif 793 793 { 794 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3,0)794 #if RTLNX_VER_MAX(3,3,0) 795 795 struct super_block *sb = mnt->mnt_sb; 796 796 #else … … 845 845 */ 846 846 static struct super_operations g_vbsf_super_ops = { 847 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,36)847 #if RTLNX_VER_MAX(2,6,36) 848 848 .clear_inode = vbsf_clear_inode, 849 849 #else 850 850 .evict_inode = vbsf_evict_inode, 851 851 #endif 852 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,25)852 #if RTLNX_VER_MAX(2,6,25) 853 853 .read_inode = vbsf_read_inode, 854 854 #endif … … 865 865 *********************************************************************************************************************************/ 866 866 867 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,4)867 #if RTLNX_VER_MIN(2,5,4) 868 868 869 869 static int vbsf_read_super_26(struct super_block *sb, void *data, int flags) … … 879 879 } 880 880 881 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) 881 # if RTLNX_VER_MIN(2,6,39) 882 static struct dentry *sf_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) 883 { 884 TRACE(); 885 return mount_nodev(fs_type, flags, data, vbsf_read_super_26); 886 } 887 # elif RTLNX_VER_MIN(2,6,18) 888 static int vbsf_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, struct vfsmount *mnt) 889 { 890 TRACE(); 891 return get_sb_nodev(fs_type, flags, data, vbsf_read_super_26, mnt); 892 } 893 # else /* < 2.6.18 */ 882 894 static struct super_block *vbsf_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) 883 895 { … … 885 897 return get_sb_nodev(fs_type, flags, data, vbsf_read_super_26); 886 898 } 887 # elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) 888 static int vbsf_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, struct vfsmount *mnt) 889 { 890 TRACE(); 891 return get_sb_nodev(fs_type, flags, data, vbsf_read_super_26, mnt); 892 } 893 # else /* LINUX_VERSION_CODE >= 2.6.39 */ 894 static struct dentry *sf_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) 895 { 896 TRACE(); 897 return mount_nodev(fs_type, flags, data, vbsf_read_super_26); 898 } 899 # endif /* LINUX_VERSION_CODE >= 2.6.39 */ 899 # endif 900 900 901 901 /** … … 905 905 .owner = THIS_MODULE, 906 906 .name = "vboxsf", 907 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) 907 # if RTLNX_VER_MIN(2,6,39) 908 .mount = sf_mount, 909 # else 908 910 .get_sb = vbsf_get_sb, 909 # else910 .mount = sf_mount,911 911 # endif 912 912 .kill_sb = kill_anon_super 913 913 }; 914 914 915 #else /* LINUX_VERSION_CODE< 2.5.4 */915 #else /* < 2.5.4 */ 916 916 917 917 static struct super_block *vbsf_read_super_24(struct super_block *sb, void *data, int flags) … … 931 931 static DECLARE_FSTYPE(g_vboxsf_fs_type, "vboxsf", vbsf_read_super_24, 0); 932 932 933 #endif /* LINUX_VERSION_CODE< 2.5.4 */933 #endif /* < 2.5.4 */ 934 934 935 935 … … 1054 1054 * Module parameters. 1055 1055 */ 1056 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,52)1056 #if RTLNX_VER_MIN(2,5,52) 1057 1057 module_param_named(follow_symlinks, g_fFollowSymlinks, int, 0); 1058 1058 MODULE_PARM_DESC(follow_symlinks, -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h
r82968 r85698 46 46 #include <VBox/log.h> 47 47 48 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0)48 #if RTLNX_VER_MIN(2,6,0) 49 49 # include <linux/backing-dev.h> 50 50 #endif … … 83 83 * inode compatibility glue. 84 84 */ 85 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,0)85 #if RTLNX_VER_MAX(2,6,0) 86 86 87 87 DECLINLINE(loff_t) i_size_read(struct inode *pInode) … … 99 99 #endif /* < 2.6.0 */ 100 100 101 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2,0) \101 #if RTLNX_VER_MAX(3,2,0) \ 102 102 && (!defined(RHEL_MAJOR) || RHEL_MAJOR != 6 || RHEL_MINOR < 10) 103 103 DECLINLINE(void) set_nlink(struct inode *pInode, unsigned int cLinks) … … 150 150 /** Mount tag for VBoxService automounter. @since 6.0 */ 151 151 char szTag[32]; 152 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 12,0)152 #if RTLNX_VER_RANGE(2,6,0, 4,12,0) 153 153 /** The backing device info structure. */ 154 154 struct backing_dev_info bdi; … … 160 160 /** The time to live for inode information in milliseconds, for /proc/mounts. */ 161 161 int32_t msInodeTTL; 162 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 2,0)162 #if RTLNX_VER_RANGE(4,0,0, 4,2,0) 163 163 /** 4.0 and 4.1 are missing noop_backing_dev_info export, so take down the 164 164 * initial value so we can restore it in vbsf_done_backing_dev(). (paranoia) */ … … 169 169 /* Following casts are here to prevent assignment of void * to 170 170 pointers of arbitrary type */ 171 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,0)171 #if RTLNX_VER_MAX(2,6,0) 172 172 # define VBSF_GET_SUPER_INFO(sb) ((struct vbsf_super_info *)(sb)->u.generic_sbp) 173 173 # define VBSF_SET_SUPER_INFO(sb, a_pSuperInfo) do { (sb)->u.generic_sbp = a_pSuperInfo; } while (0) … … 249 249 }; 250 250 251 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,19) || defined(KERNEL_FC6)251 #if RTLNX_VER_MIN(2,6,19) || defined(KERNEL_FC6) 252 252 /* FC6 kernel 2.6.18, vanilla kernel 2.6.19+ */ 253 253 # define VBSF_GET_INODE_INFO(i) ((struct vbsf_inode_info *) (i)->i_private) … … 265 265 extern int vbsf_inode_revalidate_worker(struct dentry *dentry, bool fForced, bool fInodeLocked); 266 266 extern int vbsf_inode_revalidate_with_handle(struct dentry *dentry, SHFLHANDLE hHostFile, bool fForced, bool fInodeLocked); 267 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,18)268 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0)267 #if RTLNX_VER_MIN(2,5,18) 268 # if RTLNX_VER_MIN(4,11,0) 269 269 extern int vbsf_inode_getattr(const struct path *path, struct kstat *kstat, u32 request_mask, unsigned int query_flags); 270 270 # else … … 420 420 421 421 /** Macro for getting the dentry for a struct file. */ 422 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6,0)422 #if RTLNX_VER_MIN(4,6,0) 423 423 # define VBSF_GET_F_DENTRY(f) file_dentry(f) 424 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,20)424 #elif RTLNX_VER_MIN(2,6,20) 425 425 # define VBSF_GET_F_DENTRY(f) (f->f_path.dentry) 426 426 #else
Note:
See TracChangeset
for help on using the changeset viewer.