VirtualBox

Ignore:
Timestamp:
Aug 11, 2020 5:05:29 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139838
Message:

IPRT,lnx-kmods: Use new linux kernel version checking macros. Moved them to separate wrapper header.

Location:
trunk/src/VBox/Additions/linux/sharedfolders
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/sharedfolders/dirops.c

    r82968 r85698  
    3636#include <iprt/err.h>
    3737
    38 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
     38#if RTLNX_VER_MAX(4,7,0)
    3939# define d_in_lookup(a_pDirEntry)  (d_unhashed(a_pDirEntry))
    4040#endif
     
    280280 */
    281281DECL_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)
    283283                                               struct dir_context *ctx,
    284284# else
     
    291291    int rc = vbsf_nlscpy(pSuperInfo, szDstName, sizeof(szDstName), pszSrcName, cchSrcName);
    292292    if (rc == 0) {
    293 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
     293#if RTLNX_VER_MIN(3,11,0)
    294294        return dir_emit(ctx, szDstName, strlen(szDstName), d_ino, d_type);
    295295#else
     
    327327 * c. filldir returns an error (see comment on that)
    328328 */
    329 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
     329#if RTLNX_VER_MIN(3,11,0)
    330330static int vbsf_dir_iterate(struct file *dir, struct dir_context *ctx)
    331331#else
     
    333333#endif
    334334{
    335 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
     335#if RTLNX_VER_MIN(3,11,0)
    336336    loff_t                  offPos = ctx->pos;
    337337#else
     
    403403     */
    404404    if (offPos < 2) {
    405 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
     405#if RTLNX_VER_MIN(3,11,0)
    406406        if (offPos == 0) {
    407407            if (dir_emit_dot(dir, ctx))
     
    431431        }
    432432        if (offPos == 1) {
    433 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 5)
     433# if RTLNX_VER_MIN(2,5,5)
    434434            rc = filldir(opaque, "..", 2, 1, parent_ino(VBSF_GET_F_DENTRY(dir)), DT_DIR);
    435435# else
     
    506506                bool        fContinue;
    507507                if (pSuperInfo->fNlsIsUtf8) {
    508 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
     508#if RTLNX_VER_MIN(3,11,0)
    509509                    fContinue = dir_emit(ctx, pEntry->name.String.ach, cchSrcName, d_ino, d_type);
    510510#else
     
    512512#endif
    513513                } else {
    514 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
     514#if RTLNX_VER_MIN(3,11,0)
    515515                    fContinue = vbsf_dir_emit_nls(ctx, pEntry->name.String.ach, cchSrcName, d_ino, d_type, pSuperInfo);
    516516#else
     
    536536            offPos       += 1;
    537537            dir->f_pos    = offPos;
    538 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
     538#if RTLNX_VER_MIN(3,11,0)
    539539            ctx->pos      = offPos;
    540540#endif
     
    555555struct file_operations vbsf_dir_fops = {
    556556    .open           = vbsf_dir_open,
    557 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
     557#if RTLNX_VER_MIN(4,7,0)
    558558    .iterate_shared = vbsf_dir_iterate,
    559 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
     559#elif RTLNX_VER_MIN(3,11,0)
    560560    .iterate        = vbsf_dir_iterate,
    561561#else
     
    564564    .release        = vbsf_dir_release,
    565565    .read           = generic_read_dir,
    566 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
     566#if RTLNX_VER_MIN(2,6,37)
    567567    .llseek         = generic_file_llseek
    568568#endif
     
    588588    if (sf_new_i) {
    589589        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)
    591591        struct inode *pInode  = iget_locked(parent->i_sb, iNodeNo);
    592592#else
     
    614614            if (fInstantiate)
    615615                d_instantiate(dentry, pInode);
    616 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25)
     616#if RTLNX_VER_MIN(2,4,25)
    617617            unlock_new_inode(pInode);
    618618#endif
     
    632632DECLINLINE(void) vbsf_d_add_inode(struct dentry *dentry, struct inode *pNewInode)
    633633{
    634 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
     634#if RTLNX_VER_MIN(2,6,38)
    635635    Assert(dentry->d_op == &vbsf_dentry_ops); /* (taken from the superblock) */
    636636#else
     
    651651 */
    652652static 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)
    654654                                        , unsigned int flags
    655 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
     655#elif RTLNX_VER_MIN(2,6,0)
    656656                                        , struct nameidata *nd
    657657#endif
     
    664664    int                     rc;
    665665
    666 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
     666#if RTLNX_VER_MIN(3,6,0)
    667667    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)
    669669    SFLOGFLOW(("vbsf_inode_lookup: parent=%p dentry=%p nd=%p{.flags=%#x}\n", parent, dentry, nd, nd ? nd->flags : 0));
    670670#else
     
    920920
    921921
    922 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     922#if RTLNX_VER_MIN(3,16,0)
    923923/**
    924924 * More atomic way of handling creation.
     
    930930static int vbsf_inode_atomic_open(struct inode *pDirInode, struct dentry *dentry, struct file *file,  unsigned fOpen,
    931931                                  umode_t fMode
    932 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0)
     932# if RTLNX_VER_MAX(4,19,0)
    933933                                  , int *opened
    934934# endif
     
    982982                 * and call finish_open() to do the remaining open() work.
    983983                 */
    984 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
     984# if RTLNX_VER_MIN(4,19,0)
    985985                if (fCreated)
    986986                    file->f_mode |= FMODE_CREATED;
     
    10451045 * @returns 0 on success, Linux error code otherwise
    10461046 */
    1047 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) || defined(DOXYGEN_RUNNING)
     1047#if RTLNX_VER_MIN(3,6,0) || defined(DOXYGEN_RUNNING)
    10481048static 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)
    10501050static 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)
    10521052static int vbsf_inode_create(struct inode *parent, struct dentry *dentry, int mode, struct nameidata *nd)
    10531053#else
     
    10581058                          | SHFL_CF_ACT_FAIL_IF_EXISTS
    10591059                          | 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)
    10611061    /* Clear the RD flag if write-only access requested.  Otherwise assume we
    10621062       need write access to create stuff. */
     
    10821082 * @returns 0 on success, Linux error code otherwise
    10831083 */
    1084 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
     1084#if RTLNX_VER_MIN(3,3,0)
    10851085static int vbsf_inode_mkdir(struct inode *parent, struct dentry *dentry, umode_t mode)
    10861086#else
     
    12031203    uint32_t fRename = (old_dentry->d_inode->i_mode & S_IFDIR ? SHFL_RENAME_DIR : SHFL_RENAME_FILE)
    12041204                     | SHFL_RENAME_REPLACE_IF_EXISTS;
    1205 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
     1205#if RTLNX_VER_MIN(3,15,0)
    12061206    if (!(flags & ~RENAME_NOREPLACE)) {
    12071207        if (flags & RENAME_NOREPLACE)
     
    12731273            rc = -EXDEV;
    12741274        }
    1275 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
     1275#if RTLNX_VER_MIN(3,15,0)
    12761276    } else {
    12771277        SFLOGFLOW(("vbsf_inode_rename: Unsupported flags: %#x\n", flags));
     
    12851285
    12861286
    1287 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
     1287#if RTLNX_VER_MAX(4,9,0)
    12881288/**
    12891289 * The traditional rename interface without any flags.
     
    13731373struct inode_operations vbsf_dir_iops = {
    13741374    .lookup         = vbsf_inode_lookup,
    1375 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     1375#if RTLNX_VER_MIN(3,16,0)
    13761376    .atomic_open    = vbsf_inode_atomic_open,
    13771377#endif
     
    13811381    .rmdir          = vbsf_inode_rmdir,
    13821382    .unlink         = vbsf_inode_unlink,
    1383 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
     1383#if RTLNX_VER_MIN(4,9,0)
    13841384    .rename         = vbsf_inode_rename,
    13851385#else
    13861386    .rename         = vbsf_inode_rename_no_flags,
    1387 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
     1387# if RTLNX_VER_MIN(3,15,0)
    13881388    .rename2        = vbsf_inode_rename,
    13891389# endif
    13901390#endif
    1391 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 18)
     1391#if RTLNX_VER_MIN(2,5,18)
    13921392    .getattr        = vbsf_inode_getattr,
    13931393#else
  • trunk/src/VBox/Additions/linux/sharedfolders/files_vboxsf

    r82968 r85698  
    4545    ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \
    4646    ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \
     47    ${PATH_ROOT}/include/iprt/linux/version.h=>include/iprt/linux/version.h \
    4748    ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \
    4849    ${PATH_ROOT}/include/VBox/err.h=>include/VBox/err.h \
  • trunk/src/VBox/Additions/linux/sharedfolders/lnkops.c

    r82968 r85698  
    108108}
    109109
    110 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
     110#if RTLNX_VER_MIN(4,5,0)
    111111
    112112/**
     
    147147#else /* < 4.5 */
    148148
    149 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 8)
     149# if RTLNX_VER_MAX(2,6,8)
    150150/**
    151151 * Reads the link into the given buffer.
     
    183183 * Follow link in dentry.
    184184 */
    185 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
     185# if RTLNX_VER_MIN(4,2,0)
    186186static 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)
    188188static void       *vbsf_follow_link(struct dentry *dentry, struct nameidata *nd)
    189189# else
     
    213213                 */
    214214                vbsf_dentry_chain_increase_ttl(dentry);
    215 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
     215# if RTLNX_VER_MIN(4,2,0)
    216216                *cookie = pszTarget;
    217217                return pszTarget;
    218 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 8)
     218# elif RTLNX_VER_MIN(2,6,8)
    219219                nd_set_link(nd, pszTarget);
    220 #  if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
     220#  if RTLNX_VER_MIN(2,6,13)
    221221                return NULL;
    222222#  else
     
    241241        rc = -ENOMEM;
    242242    }
    243 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
     243# if RTLNX_VER_MIN(4,2,0)
    244244    *cookie = ERR_PTR(rc);
    245245    return (const char *)ERR_PTR(rc);
    246 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 8)
     246# elif RTLNX_VER_MIN(2,6,8)
    247247    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)
    249249    return NULL;
    250250#  else
     
    256256}
    257257
    258 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 8)
     258# if RTLNX_VER_MIN(2,6,8)
    259259/**
    260260 * For freeing target link buffer allocated by vbsf_follow_link.
     
    262262 * For kernels before 2.6.8 memory isn't being kept around.
    263263 */
    264 #  if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
     264#  if RTLNX_VER_MIN(4,2,0)
    265265static 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)
    267267static void vbsf_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
    268268#  else
     
    270270#  endif
    271271{
    272 #  if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
     272#  if RTLNX_VER_MIN(2,6,13)
    273273    char *page = cookie;
    274274#  else
     
    287287 */
    288288struct 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)
    291291    .readlink    = generic_readlink,
    292292# else
     
    294294# endif
    295295#endif
    296 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
     296#if RTLNX_VER_MIN(4,5,0)
    297297    .get_link    = vbsf_get_link
    298298#else
    299299    .follow_link = vbsf_follow_link,
    300 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 8)
     300# if RTLNX_VER_MIN(2,6,8)
    301301    .put_link    = vbsf_put_link,
    302302# endif
  • trunk/src/VBox/Additions/linux/sharedfolders/regops.c

    r85693 r85698  
    3535#include "vfsmod.h"
    3636#include <linux/uio.h>
    37 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 32)
     37#if RTLNX_VER_MIN(2,5,32)
    3838# include <linux/aio.h> /* struct kiocb before 4.1 */
    3939#endif
    40 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 12)
     40#if RTLNX_VER_MIN(2,5,12)
    4141# include <linux/buffer_head.h>
    4242#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)
    4544# include <linux/writeback.h>
    4645#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)
    4947# include <linux/splice.h>
    5048#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)
    5350# include <linux/pipe_fs_i.h>
    5451#endif
    55 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 10)
     52#if RTLNX_VER_MIN(2,4,10)
    5653# include <linux/swap.h> /* for mark_page_accessed */
    5754#endif
    5855#include <iprt/err.h>
    5956
    60 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
     57#if RTLNX_VER_MAX(2,6,18)
    6158# define SEEK_END 2
    6259#endif
    6360
    64 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
     61#if RTLNX_VER_MAX(3,16,0)
    6562# 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)
    6764# define iter_is_iovec(a_pIter) ( !((a_pIter)->type & (ITER_KVEC | ITER_BVEC)) )
    6865#endif
    6966
    70 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
     67#if RTLNX_VER_MAX(4,17,0)
    7168# define vm_fault_t int
    7269#endif
    7370
    74 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 20)
     71#if RTLNX_VER_MAX(2,5,20)
    7572# define pgoff_t    unsigned long
    7673#endif
    7774
    78 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 12)
     75#if RTLNX_VER_MAX(2,5,12)
    7976# define PageUptodate(a_pPage) Page_Uptodate(a_pPage)
    8077#endif
     
    8481*   Structures and Typedefs                                                                                                      *
    8582*********************************************************************************************************************************/
    86 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
     83#if RTLNX_VER_MAX(3,16,0)
    8784struct vbsf_iov_iter {
    8885    unsigned int        type;
     
    107104#endif
    108105
    109 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
     106#if RTLNX_VER_MIN(2,6,19)
    110107/** Used by vbsf_iter_lock_pages() to keep the first page of the next segment. */
    111108struct vbsf_iter_stash {
     
    113110    size_t          off;
    114111    size_t          cb;
    115 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
     112# if RTLNX_VER_MAX(4,11,0)
    116113    size_t          offFromEnd;
    117114    struct iov_iter Copy;
     
    120117#endif /* >= 3.16.0 */
    121118/** Initializer for struct vbsf_iter_stash. */
    122 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
     119#if RTLNX_VER_MIN(4,11,0)
    123120# define VBSF_ITER_STASH_INITIALIZER    { NULL, 0 }
    124121#else
     
    140137*   Provide more recent uio.h functionality to older kernels.                                                                    *
    141138*********************************************************************************************************************************/
    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)
    143140
    144141/**
     
    299296
    300297#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)
    302299
    303300/** This is for implementing cMaxPage on 3.16 which doesn't have it. */
     
    319316
    320317#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)
    322319
    323320static size_t copy_from_iter(uint8_t *pbDst, size_t cbToCopy, struct iov_iter *pSrcIter)
     
    325322    size_t const cbTotal = cbToCopy;
    326323    Assert(iov_iter_count(pSrcIter) >= cbToCopy);
    327 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     324# if RTLNX_VER_MIN(3,16,0)
    328325    if (pSrcIter->type & ITER_BVEC) {
    329326        while (cbToCopy > 0) {
     
    364361    size_t const cbTotal = cbToCopy;
    365362    Assert(iov_iter_count(pDstIter) >= cbToCopy);
    366 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     363# if RTLNX_VER_MIN(3,16,0)
    367364    if (pDstIter->type & ITER_BVEC) {
    368365        while (cbToCopy > 0) {
     
    555552*********************************************************************************************************************************/
    556553
    557 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 6)
     554#if RTLNX_VER_MAX(2,6,6)
    558555/** Any writable mappings? */
    559556DECLINLINE(bool) mapping_writably_mapped(struct address_space const *mapping)
    560557{
    561 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 6)
     558# if RTLNX_VER_MIN(2,5,6)
    562559    return !list_empty(&mapping->i_mmap_shared);
    563560# else
     
    568565
    569566
    570 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 12)
     567#if RTLNX_VER_MAX(2,5,12)
    571568/** Missing in 2.4.x, so just stub it for now. */
    572569DECLINLINE(bool) PageWriteback(struct page const *page)
     
    604601*********************************************************************************************************************************/
    605602
    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)
    610606#  define LOCK_PIPE(a_pPipe)   do { if ((a_pPipe)->inode) mutex_lock(&(a_pPipe)->inode->i_mutex); } while (0)
    611607#  define UNLOCK_PIPE(a_pPipe) do { if ((a_pPipe)->inode) mutex_unlock(&(a_pPipe)->inode->i_mutex); } while (0)
     
    647643
    648644#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)
    651646
    652647/** Verify pipe buffer content (needed for page-cache to ensure idle page). */
     
    721716static struct pipe_buf_operations vbsf_pipe_buf_ops = {
    722717    .can_merge = 0,
    723 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
     718# if RTLNX_VER_MIN(2,6,23)
    724719    .confirm   = vbsf_pipe_buf_confirm,
    725720# else
     
    754749            pPipeBuf->len       = cbThisPage;
    755750            pPipeBuf->offset    = offPg0;
    756 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
     751# if RTLNX_VER_MIN(2,6,23)
    757752            pPipeBuf->private   = 0;
    758753# endif
     
    895890
    896891#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)
    899893
    900894/**
     
    10171011                                pPipeBuf = &pPipe->bufs[pPipe->curbuf];
    10181012
    1019 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
     1013# if RTLNX_VER_MAX(2,6,30)
    10201014                                fNeedWakeUp |= pPipe->inode != NULL;
    10211015# else
     
    10921086#endif /* 2.6.17 <= LINUX_VERSION_CODE < 3.16.0 */
    10931087
    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)
    10961089/**
    10971090 * Our own senfile implementation that does not go via the page cache like
     
    10991092 */
    11001093static 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)
    11021095                                 void *pvUser
    11031096# else
     
    11611154                read_descriptor_t     RdDesc;
    11621155                RdDesc.count    = cbToSend;
    1163 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 8)
     1156# if RTLNX_VER_MIN(2,6,8)
    11641157                RdDesc.arg.data = pvUser;
    11651158# else
     
    12901283DECLINLINE(void) vbsf_put_page(struct page *pPage)
    12911284{
    1292 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
     1285#if RTLNX_VER_MIN(4,6,0)
    12931286    put_page(pPage);
    12941287#else
     
    13011294DECLINLINE(void) vbsf_get_page(struct page *pPage)
    13021295{
    1303 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
     1296#if RTLNX_VER_MIN(4,6,0)
    13041297    get_page(pPage);
    13051298#else
     
    14091402     * Check that this is valid user memory that is actually in the kernel range.
    14101403     */
    1411 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) || defined(RHEL_81)
     1404#if RTLNX_VER_MIN(5,0,0) || defined(RHEL_81)
    14121405    if (   access_ok((void *)uPtrFrom, cPages << PAGE_SHIFT)
    14131406        && uPtrFrom >= USER_DS.seg)
     
    14761469static ssize_t vbsf_reg_read_mapped(struct file *file, char /*__user*/ *buf, size_t size, loff_t *off)
    14771470{
    1478 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     1471#if RTLNX_VER_MIN(3,16,0)
    14791472    struct iovec    iov = { .iov_base = buf, .iov_len = size };
    14801473    struct iov_iter iter;
     
    14911484    return cbRet;
    14921485
    1493 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
     1486#elif RTLNX_VER_MIN(2,6,19)
    14941487    struct iovec    iov = { .iov_base = buf, .iov_len = size };
    14951488    struct kiocb    kiocb;
     
    17781771                    if (cbToCopy == PAGE_SIZE)
    17791772                        SetPageUptodate(pDstPage);
    1780 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 10)
     1773# if RTLNX_VER_MIN(2,4,10)
    17811774                    mark_page_accessed(pDstPage);
    17821775# endif
     
    19871980        && mapping->nrpages > 0
    19881981        && mapping_writably_mapped(mapping)) {
    1989 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
     1982#if RTLNX_VER_MIN(2,6,32)
    19901983        int err = filemap_fdatawait_range(mapping, pos, pos + size - 1);
    19911984        if (err)
     
    20792072}
    20802073
    2081 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
     2074#if RTLNX_VER_MIN(2,6,19)
    20822075
    20832076/**
     
    21472140            SFLOG3(("vbsf_iter_lock_pages: Picked up stashed page: %#zx LB %#zx\n", offPage0, cbChunk));
    21482141        } else {
    2149 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
     2142# if RTLNX_VER_MAX(4,11,0)
    21502143            /*
    21512144             * Copy out our starting point to assist rewinding.
     
    21662159            ssize_t cbSegRet;
    21672160            if (cPages == 0) {
    2168 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
     2161# if RTLNX_VER_MAX(3,19,0)
    21692162                while (!iov_iter_single_seg_count(iter)) /* Old code didn't skip empty segments which caused EFAULTs. */
    21702163                    iov_iter_advance(iter, 0);
     
    22592252         *       and vbsf_lock_user_pages_failed_check_kernel() as well.
    22602253         */
    2261 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
     2254# if RTLNX_VER_MAX(4,11,0)
    22622255        pStash->offFromEnd = iov_iter_count(iter);
    22632256        pStash->Copy       = *iter;
     
    22742267            }
    22752268
    2276 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
     2269# if RTLNX_VER_MIN(3,19,0)
    22772270            pbBuf    = iter->kvec->iov_base + iter->iov_offset;
    22782271# else
     
    23392332    }
    23402333
    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)
    23422335    iov_iter_revert(iter, cbToRewind + cbExtra);
    23432336    return true;
     
    23692362{
    23702363    size_t cPages;
    2371 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     2364# if RTLNX_VER_MIN(3,16,0)
    23722365    if (iter_is_iovec(iter) || (iter->type & ITER_KVEC)) {
    23732366#endif
     
    24292422        if (cPagesSpan > cPages)
    24302423            cPages = cPagesSpan;
    2431 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     2424# if RTLNX_VER_MIN(3,16,0)
    24322425    } else {
    24332426        /* Won't bother with accurate counts for the next two types, just make
     
    25682561 * @param   iter        The I/O vector iterator describing the buffer.
    25692562 */
    2570 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     2563# if RTLNX_VER_MIN(3,16,0)
    25712564static ssize_t vbsf_reg_read_iter(struct kiocb *kio, struct iov_iter *iter)
    25722565# else
     
    25742567# endif
    25752568{
    2576 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
     2569# if RTLNX_VER_MAX(3,16,0)
    25772570    struct vbsf_iov_iter    fake_iter  = VBSF_IOV_ITER_INITIALIZER(cSegs, iov, 0 /*write*/);
    25782571    struct vbsf_iov_iter   *iter       = &fake_iter;
     
    26022595     */
    26032596    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)
    26052598        return generic_file_read_iter(kio, iter);
    26062599# else
     
    27942787 * @param   iter        The I/O vector iterator describing the buffer.
    27952788 */
    2796 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     2789# if RTLNX_VER_MIN(3,16,0)
    27972790static ssize_t vbsf_reg_write_iter(struct kiocb *kio, struct iov_iter *iter)
    27982791# else
     
    28002793# endif
    28012794{
    2802 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
     2795# if RTLNX_VER_MAX(3,16,0)
    28032796    struct vbsf_iov_iter    fake_iter  = VBSF_IOV_ITER_INITIALIZER(cSegs, iov, 1 /*write*/);
    28042797    struct vbsf_iov_iter   *iter       = &fake_iter;
     
    28112804    struct vbsf_reg_info   *sf_r       = kio->ki_filp->private_data;
    28122805    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)
    28142807    loff_t                  offFile    = kio->ki_pos;
    28152808# endif
    2816 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
     2809# if RTLNX_VER_MIN(4,1,0)
    28172810    bool const              fAppend    = RT_BOOL(kio->ki_flags & IOCB_APPEND);
    28182811# else
     
    28542847        && mapping->nrpages > 0
    28552848        && mapping_writably_mapped(mapping)) {
    2856 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
     2849# if RTLNX_VER_MIN(2,6,32)
    28572850        int err = filemap_fdatawait_range(mapping, offFile, offFile + cbToWrite - 1);
    28582851        if (err)
     
    28902883                            i_size_write(inode, offFile);
    28912884
    2892 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
     2885# if RTLNX_VER_MIN(4,11,0)
    28932886                        if ((size_t)cbRet < cbToWrite)
    28942887                            iov_iter_revert(iter, cbToWrite - cbRet);
     
    31293122            && mapping->nrpages > 0
    31303123            /** @todo && last writable handle */ ) {
    3131 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25)
     3124#if RTLNX_VER_MIN(2,4,25)
    31323125            if (filemap_fdatawrite(mapping) != -EIO)
    31333126#else
     
    31763169    }
    31773170
    3178 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 8)
     3171#if RTLNX_VER_MIN(2,4,8)
    31793172    return generic_file_llseek(file, off, whence);
    31803173#else
     
    31923185 * well as any host interaction with the file.
    31933186 */
    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 */)
    31963189static int vbsf_reg_fsync(struct file *file, loff_t start, loff_t end, int datasync)
    31973190{
    3198 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     3191# if RTLNX_VER_MIN(3,16,0)
    31993192    return __generic_file_fsync(file, start, end, datasync);
    32003193# else
     
    32023195# endif
    32033196}
    3204 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
     3197#elif RTLNX_VER_MIN(2,6,35)
    32053198static int vbsf_reg_fsync(struct file *file, int datasync)
    32063199{
     
    32103203static int vbsf_reg_fsync(struct file *file, struct dentry *dentry, int datasync)
    32113204{
    3212 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
     3205# if RTLNX_VER_MIN(2,6,31)
    32133206    return simple_fsync(file, dentry, datasync);
    32143207# else
     
    32193212    /** @todo What about file_fsync()? (<= 2.5.11) */
    32203213
    3221 #  if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 12)
     3214#  if RTLNX_VER_MIN(2,5,12)
    32223215    rc = sync_mapping_buffers(inode->i_mapping);
    32233216    if (   rc == 0
     
    32403233     */
    32413234    rc = fsync_inode_buffers(inode);
    3242 #   if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 10)
     3235#   if RTLNX_VER_MIN(2,4,10)
    32433236    if (rc == 0 && datasync)
    32443237        rc = fsync_inode_data_buffers(inode);
     
    32523245
    32533246
    3254 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
     3247#if RTLNX_VER_MIN(4,5,0)
    32553248/**
    32563249 * Copy a datablock from one file to another on the host side.
     
    32793272        Assert(pInodeInfoDst->u32Magic == SF_INODE_INFO_MAGIC);
    32803273
    3281 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
     3274# if RTLNX_VER_MAX(4,11,0)
    32823275        if (!S_ISREG(pInodeSrc->i_mode) || !S_ISREG(pInodeDst->i_mode))
    32833276            return S_ISDIR(pInodeSrc->i_mode) || S_ISDIR(pInodeDst->i_mode) ? -EISDIR : -EINVAL;
     
    33233316
    33243317/* Generic page fault callback: */
    3325 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
     3318# if RTLNX_VER_MIN(4,11,0)
    33263319static vm_fault_t vbsf_vmlog_fault(struct vm_fault *vmf)
    33273320{
     
    33323325    return rc;
    33333326}
    3334 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
     3327# elif RTLNX_VER_MIN(2,6,23)
    33353328static int vbsf_vmlog_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
    33363329{
    33373330    int rc;
    3338 #  if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
     3331#  if RTLNX_VER_MIN(4,10,0)
    33393332    SFLOGFLOW(("vbsf_vmlog_fault: vma=%p vmf=%p flags=%#x addr=%p\n", vma, vmf, vmf->flags, vmf->address));
    33403333#  else
     
    33493342
    33503343/* 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)
    33533346static struct page *vbsf_vmlog_nopage(struct vm_area_struct *vma, unsigned long address, int *type)
    33543347{
     
    33723365
    33733366/* 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)
    33753368static vm_fault_t vbsf_vmlog_page_mkwrite(struct vm_fault *vmf)
    33763369{
     
    33813374    return rc;
    33823375}
    3383 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
     3376# elif RTLNX_VER_MIN(2,6,30)
    33843377static int vbsf_vmlog_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
    33853378{
    33863379    int rc;
    3387 #  if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
     3380#  if RTLNX_VER_MIN(4,10,0)
    33883381    SFLOGFLOW(("vbsf_vmlog_page_mkwrite: vma=%p vmf=%p flags=%#x addr=%p\n", vma, vmf, vmf->flags, vmf->address));
    33893382#  else
     
    33943387    return rc;
    33953388}
    3396 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
     3389# elif RTLNX_VER_MIN(2,6,18)
    33973390static int vbsf_vmlog_page_mkwrite(struct vm_area_struct *vma, struct page *page)
    33983391{
     
    34073400
    34083401/* 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)
    34103403static void vbsf_vmlog_map_pages(struct vm_fault *vmf, pgoff_t start, pgoff_t end)
    34113404{
     
    34143407    SFLOGFLOW(("vbsf_vmlog_map_pages: returns\n"));
    34153408}
    3416 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
     3409# elif RTLNX_VER_MIN(4,8,0)
    34173410static void vbsf_vmlog_map_pages(struct fault_env *fenv, pgoff_t start, pgoff_t end)
    34183411{
     
    34213414    SFLOGFLOW(("vbsf_vmlog_map_pages: returns\n"));
    34223415}
    3423 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
     3416# elif RTLNX_VER_MIN(3,15,0)
    34243417static void vbsf_vmlog_map_pages(struct vm_area_struct *vma, struct vm_fault *vmf)
    34253418{
     
    34333426/** Overload template. */
    34343427static 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)
    34363429    .fault = vbsf_vmlog_fault,
    34373430# endif
    3438 # if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 25)
     3431# if RTLNX_VER_MAX(2,6,26)
    34393432    .nopage = vbsf_vmlog_nopage,
    34403433# endif
    3441 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
     3434# if RTLNX_VER_MIN(2,6,18)
    34423435    .page_mkwrite = vbsf_vmlog_page_mkwrite,
    34433436# endif
    3444 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
     3437# if RTLNX_VER_MIN(3,15,0)
    34453438    .map_pages = vbsf_vmlog_map_pages,
    34463439# endif
     
    34993492    .read            = vbsf_reg_read,
    35003493    .write           = vbsf_reg_write,
    3501 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     3494#if RTLNX_VER_MIN(3,16,0)
    35023495    .read_iter       = vbsf_reg_read_iter,
    35033496    .write_iter      = vbsf_reg_write_iter,
    3504 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
     3497#elif RTLNX_VER_MIN(2,6,19)
    35053498    .aio_read        = vbsf_reg_aio_read,
    35063499    .aio_write       = vbsf_reg_aio_write,
     
    35123505    .mmap            = generic_file_mmap,
    35133506#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)
    35153508    .splice_read     = vbsf_splice_read,
    35163509#endif
    3517 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
     3510#if RTLNX_VER_MIN(3,16,0)
    35183511    .splice_write    = iter_file_splice_write,
    3519 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17)
     3512#elif RTLNX_VER_MIN(2,6,17)
    35203513    .splice_write    = vbsf_splice_write,
    35213514#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)
    35233516    .sendfile        = vbsf_reg_sendfile,
    35243517#endif
    35253518    .llseek          = vbsf_reg_llseek,
    35263519    .fsync           = vbsf_reg_fsync,
    3527 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
     3520#if RTLNX_VER_MIN(4,5,0)
    35283521    .copy_file_range = vbsf_reg_copy_file_range,
    35293522#endif
     
    35353528 */
    35363529struct inode_operations vbsf_reg_iops = {
    3537 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 18)
     3530#if RTLNX_VER_MIN(2,5,18)
    35383531    .getattr    = vbsf_inode_getattr,
    35393532#else
     
    36213614 * fashion.
    36223615 */
    3623 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 52)
     3616#if RTLNX_VER_MIN(2,5,52)
    36243617static int vbsf_writepage(struct page *page, struct writeback_control *wbc)
    36253618#else
     
    36983691
    36993692
    3700 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
     3693#if RTLNX_VER_MIN(2,6,24)
    37013694/**
    37023695 * Called when writing thru the page cache (which we shouldn't be doing).
     
    37243717
    37253718
    3726 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 10)
     3719#if RTLNX_VER_MIN(2,4,10)
    37273720
    37283721# ifdef VBOX_UEK
     
    37743767    .writepage      = vbsf_writepage,
    37753768    /** @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)
    37773770    .set_page_dirty = __set_page_dirty_buffers,
    37783771#endif
    3779 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
     3772#if RTLNX_VER_MIN(2,6,24)
    37803773    .write_begin    = vbsf_write_begin,
    37813774    .write_end      = simple_write_end,
    3782 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 45)
     3775#elif RTLNX_VER_MIN(2,5,45)
    37833776    .prepare_write  = simple_prepare_write,
    37843777    .commit_write   = simple_commit_write,
    37853778#endif
    3786 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 10)
     3779#if RTLNX_VER_MIN(2,4,10)
    37873780    .direct_IO      = vbsf_direct_IO,
    37883781#endif
  • trunk/src/VBox/Additions/linux/sharedfolders/utils.c

    r82968 r85698  
    5151
    5252        while (in_bound_len) {
    53 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
     53#if RTLNX_VER_MIN(2,6,31)
    5454            unicode_t uni;
    5555            int cbInEnc = utf8_to_utf32(in, in_bound_len, &uni);
     
    112112            if (cbNlsCodepoint >= 0) {
    113113                char achTmp[16];
    114 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
     114#if RTLNX_VER_MIN(2,6,31)
    115115                int cbUtf8Codepoint = utf32_to_utf8(uc, achTmp, sizeof(achTmp));
    116116#else
     
    145145                    int const cbNlsCodepoint = pSuperInfo->nls->char2uni(&pszNls[offNls], cchNls - offNls, &uc);
    146146                    if (cbNlsCodepoint >= 0) {
    147 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
     147#if RTLNX_VER_MIN(2,6,31)
    148148                        int cbUtf8Codepoint = utf32_to_utf8(uc, pchDst, cchUtf8);
    149149#else
     
    215215 * Convert from VBox to linux time.
    216216 */
    217 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
     217#if RTLNX_VER_MAX(2,6,0)
    218218DECLINLINE(void) vbsf_time_to_linux(time_t *pLinuxDst, PCRTTIMESPEC pVBoxSrc)
    219219{
     
    223223}
    224224#else   /* >= 2.6.0 */
    225 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
     225# if RTLNX_VER_MAX(4,18,0)
    226226DECLINLINE(void) vbsf_time_to_linux(struct timespec *pLinuxDst, PCRTTIMESPEC pVBoxSrc)
    227227# else
     
    239239 * Convert from linux to VBox time.
    240240 */
    241 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
     241#if RTLNX_VER_MAX(2,6,0)
    242242DECLINLINE(void) vbsf_time_to_vbox(PRTTIMESPEC pVBoxDst, time_t *pLinuxSrc)
    243243{
     
    245245}
    246246#else   /* >= 2.6.0 */
    247 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
     247# if RTLNX_VER_MAX(4,18,0)
    248248DECLINLINE(void) vbsf_time_to_vbox(PRTTIMESPEC pVBoxDst, struct timespec const *pLinuxSrc)
    249249# else
     
    327327        inode->i_fop = &vbsf_reg_fops;
    328328        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)
    331330        inode->i_mapping->backing_dev_info = &pSuperInfo->bdi; /* This is needed for mmap. */
    332331#endif
     
    334333    }
    335334
    336 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
     335#if RTLNX_VER_MIN(3,5,0)
    337336    inode->i_uid = make_kuid(current_user_ns(), pSuperInfo->uid);
    338337    inode->i_gid = make_kgid(current_user_ns(), pSuperInfo->gid);
     
    343342
    344343    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)
    346345    inode->i_blksize = 4096;
    347346#endif
    348 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 11)
     347#if RTLNX_VER_MIN(2,4,11)
    349348    inode->i_blkbits = 12;
    350349#endif
     
    374373    TRACE();
    375374
    376 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
     375#if RTLNX_VER_MIN(4,5,0)
    377376    if (!fInodeLocked)
    378377        inode_lock(pInode);
     
    402401            vbsf_init_inode(pInode, pInodeInfo, pObjInfo, pSuperInfo);
    403402
    404 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
     403#if RTLNX_VER_MIN(4,5,0)
    405404            if (!fInodeLocked)
    406405                inode_unlock(pInode);
     
    467466                    if (mapping && mapping->nrpages > 0) {
    468467                        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)
    470469                        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)
    472471                        invalidate_inode_pages(mapping);
    473472#else
     
    487486     * Done.
    488487     */
    489 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
     488#if RTLNX_VER_MIN(4,5,0)
    490489    if (!fInodeLocked)
    491490        inode_unlock(pInode);
     
    627626
    628627
    629 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 18)
     628#if RTLNX_VER_MAX(2,5,18)
    630629/**
    631630 * Revalidate an inode for 2.4.
     
    700699   has inode at all) from these new attributes we derive [kstat] via
    701700   [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)
    705704int vbsf_inode_getattr(const struct path *path, struct kstat *kstat, u32 request_mask, unsigned int flags)
    706705# else
     
    709708{
    710709    int            rc;
    711 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
     710# if RTLNX_VER_MIN(4,11,0)
    712711    struct dentry *dentry = path->dentry;
    713712# endif
    714713
    715 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
     714# if RTLNX_VER_MIN(4,11,0)
    716715    SFLOGFLOW(("vbsf_inode_getattr: dentry=%p request_mask=%#x flags=%#x\n", dentry, request_mask, flags));
    717716# else
     
    719718# endif
    720719
    721 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
     720# if RTLNX_VER_MIN(4,11,0)
    722721    /*
    723722     * With the introduction of statx() userland can control whether we
     
    745744
    746745        /* Add birth time. */
    747 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
     746# if RTLNX_VER_MIN(4,11,0)
    748747        if (dentry->d_inode) {
    749748            struct vbsf_inode_info *pInodeInfo = VBSF_GET_INODE_INFO(dentry->d_inode);
     
    807806     */
    808807    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))
    810809    rc = setattr_prepare(dentry, iattr);
    811810#else
     
    818817         */
    819818        unsigned fAttrs = iattr->ia_valid;
    820 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
     819#if RTLNX_VER_MIN(2,6,15)
    821820        fAttrs &= ~ATTR_FILE;
    822821#endif
    823822        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)
    825824            || (fAttrs & (ATTR_OPEN | ATTR_SIZE)) == (ATTR_OPEN | ATTR_SIZE)
    826825#endif
     
    10671066            in += nb;
    10681067
    1069 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
     1068#if RTLNX_VER_MIN(2,6,31)
    10701069            nb = utf32_to_utf8(uni, out, out_bound_len);
    10711070#else
     
    11131112 * @note Caller holds no relevant locks, just a dentry reference.
    11141113 */
    1115 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
     1114#if RTLNX_VER_MIN(3,6,0)
    11161115static 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)
    11181117static int vbsf_dentry_revalidate(struct dentry *dentry, struct nameidata *nd)
    11191118#else
     
    11211120#endif
    11221121{
    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)
    11241123    int const flags = nd ? nd->flags : 0;
    11251124#endif
     
    11391138     *
    11401139     */
    1141 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
     1140#if RTLNX_VER_MIN(2,6,38)
    11421141    if (flags & LOOKUP_RCU) {
    11431142        rc = -ECHILD;
     
    11811180             * later point).
    11821181             */
    1183 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
     1182#if RTLNX_VER_MIN(2,6,28)
    11841183            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)
    11861185            if (flags & LOOKUP_CREATE)
    11871186#else
     
    12141213
    12151214/** For logging purposes only. */
    1216 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
     1215# if RTLNX_VER_MIN(2,6,38)
    12171216static int vbsf_dentry_delete(const struct dentry *pDirEntry)
    12181217# else
     
    12241223}
    12251224
    1226 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
     1225# if RTLNX_VER_MIN(4,8,0)
    12271226/** For logging purposes only. */
    12281227static int vbsf_dentry_init(struct dentry *pDirEntry)
     
    12441243#ifdef SFLOG_ENABLED
    12451244    .d_delete = vbsf_dentry_delete,
    1246 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
     1245# if RTLNX_VER_MIN(4,8,0)
    12471246    .d_init = vbsf_dentry_init,
    12481247# endif
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c

    r85432 r85698  
    4646#include "revision-generated.h"
    4747#include "product-generated.h"
    48 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
     48#if RTLNX_VER_MIN(5,0,0)
    4949# 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)
    5151# include <linux/mount.h>
    5252#endif
    5353#include <linux/seq_file.h>
    5454#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)
    5656# include <linux/vermagic.h>
    5757#endif
     
    356356{
    357357    int rc = 0;
    358 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
     358#if RTLNX_VER_MIN(2,6,0)
    359359    /* Each new shared folder map gets a new uint64_t identifier,
    360360     * 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)
    362362    static uint64_t s_u64Sequence = 0;
    363363    uint64_t idSeqMine = ASMAtomicIncU64(&s_u64Sequence);
     
    365365    struct backing_dev_info *bdi;
    366366
    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)
    368368    pSuperInfo->bdi_org = sb->s_bdi;
    369369# endif
    370370
    371 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
     371# if RTLNX_VER_MIN(4,12,0)
    372372    rc = super_setup_bdi_name(sb, "vboxsf-%llu", (unsigned long long)idSeqMine);
    373373    if (!rc)
     
    381381    bdi->ra_pages = 0;                      /* No readahead */
    382382
    383 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12)
     383# if RTLNX_VER_MIN(2,6,12)
    384384    bdi->capabilities = 0
    385385#  ifdef BDI_CAP_MAP_DIRECT
     
    399399#  endif
    400400#  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.
    402402                                                       * Only tested successfully with 4.19.  Maybe skip altogether? */
    403403                      | BDI_CAP_STRICTLIMIT;
     
    414414# endif /* >= 2.6.12 */
    415415
    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)
    417417    rc = bdi_init(&pSuperInfo->bdi);
    418 #  if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
     418#  if RTLNX_VER_MIN(2,6,26)
    419419    if (!rc)
    420420        rc = bdi_register(&pSuperInfo->bdi, NULL, "vboxsf-%llu", (unsigned long long)idSeqMine);
     
    422422# endif  /* 4.11.0 > version >= 2.6.24 */
    423423
    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)
    425425    if (!rc)
    426426        sb->s_bdi = bdi;
     
    437437static void vbsf_done_backing_dev(struct super_block *sb, struct vbsf_super_info *pSuperInfo)
    438438{
    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)
    440440    bdi_destroy(&pSuperInfo->bdi);    /* includes bdi_unregister() */
    441441
    442442    /* Paranoia: Make sb->s_bdi not point at pSuperInfo->bdi, in case someone
    443443                 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)
    445445    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)
    447447    sb->s_bdi = &noop_backing_dev_info;
    448448# endif
     
    491491             * Note! ls -la does display '.' and '..' entries with st_ino == 0, so root is #1.
    492492             */
    493 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25)
     493#if RTLNX_VER_MIN(2,4,25)
    494494            struct inode *iroot = iget_locked(sb, 1);
    495495#else
     
    500500                VBSF_SET_INODE_INFO(iroot, sf_i);
    501501
    502 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25)
     502#if RTLNX_VER_MIN(2,4,25)
    503503                unlock_new_inode(iroot);
    504504#endif
     
    507507                 * Now make it a root inode.
    508508                 */
    509 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
     509#if RTLNX_VER_MIN(3,4,0)
    510510                sb->s_root = d_make_root(iroot);
    511511#else
     
    518518
    519519                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 */
    521521                iput(iroot);
    522522#endif
     
    582582        sb->s_magic     = 0xface;
    583583        sb->s_blocksize = 1024;
    584 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 3)
     584#if RTLNX_VER_MIN(2,4,3)
    585585        /* Required for seek/sendfile (see 'loff_t max' in fs/read_write.c / do_sendfile()). */
    586586# if defined MAX_LFS_FILESIZE
     
    592592# endif
    593593#endif
    594 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
     594#if RTLNX_VER_MIN(2,6,11)
    595595        sb->s_time_gran = 1; /* This might be a little optimistic for windows hosts, where it should be 100. */
    596596#endif
    597597        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)
    599599        sb->s_d_op      = &vbsf_dentry_ops;
    600600#endif
     
    629629 * We must free the inode info structure here.
    630630 */
    631 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
     631#if RTLNX_VER_MIN(2,6,36)
    632632static void vbsf_evict_inode(struct inode *inode)
    633633#else
     
    642642     * Flush stuff.
    643643     */
    644 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
     644#if RTLNX_VER_MIN(2,6,36)
    645645    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)
    647647    clear_inode(inode);
    648648# else
     
    673673   hence we can't do anything here, and let lookup/whatever with the
    674674   job to properly fill then [inode] */
    675 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
     675#if RTLNX_VER_MAX(2,6,25)
    676676static void vbsf_read_inode(struct inode *inode)
    677677{
     
    696696 * Get file system statistics.
    697697 */
    698 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
     698#if RTLNX_VER_MIN(2,6,18)
    699699static 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)
    701701static int vbsf_statfs(struct super_block *sb, struct kstatfs *stat)
    702702#else
     
    704704#endif
    705705{
    706 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
     706#if RTLNX_VER_MIN(2,6,18)
    707707    struct super_block *sb = dentry->d_inode->i_sb;
    708708#endif
     
    716716            stat->f_type   = UINT32_C(0x786f4256); /* 'VBox' little endian */
    717717            stat->f_bsize  = pVolInfo->ulBytesPerAllocationUnit;
    718 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 73)
     718#if RTLNX_VER_MIN(2,5,73)
    719719            stat->f_frsize = pVolInfo->ulBytesPerAllocationUnit;
    720720#endif
     
    731731            stat->f_fsid.val[1] = 0;
    732732            stat->f_namelen = 255;
    733 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
     733#if RTLNX_VER_MIN(2,6,36)
    734734            stat->f_flags = 0; /* not valid */
    735735#endif
     
    746746static int vbsf_remount_fs(struct super_block *sb, int *flags, char *data)
    747747{
    748 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 23)
     748#if RTLNX_VER_MIN(2,4,23)
    749749    struct vbsf_super_info *pSuperInfo = pSuperInfo = VBSF_GET_SUPER_INFO(sb);
    750750    struct vbsf_inode_info *sf_i;
     
    774774    /*unlock_new_inode(iroot); */
    775775    return 0;
    776 #else  /* LINUX_VERSION_CODE < 2.4.23 */
     776#else  /* < 2.4.23 */
    777777    return -ENOSYS;
    778 #endif /* LINUX_VERSION_CODE < 2.4.23 */
     778#endif /* < 2.4.23 */
    779779}
    780780
     
    786786 * the the 'szTag' option value it sets on its mount.
    787787 */
    788 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
     788#if RTLNX_VER_MAX(3,3,0)
    789789static int vbsf_show_options(struct seq_file *m, struct vfsmount *mnt)
    790790#else
     
    792792#endif
    793793{
    794 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
     794#if RTLNX_VER_MAX(3,3,0)
    795795    struct super_block     *sb         = mnt->mnt_sb;
    796796#else
     
    845845 */
    846846static 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)
    848848    .clear_inode  = vbsf_clear_inode,
    849849#else
    850850    .evict_inode  = vbsf_evict_inode,
    851851#endif
    852 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
     852#if RTLNX_VER_MAX(2,6,25)
    853853    .read_inode   = vbsf_read_inode,
    854854#endif
     
    865865*********************************************************************************************************************************/
    866866
    867 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 4)
     867#if RTLNX_VER_MIN(2,5,4)
    868868
    869869static int vbsf_read_super_26(struct super_block *sb, void *data, int flags)
     
    879879}
    880880
    881 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
     881# if RTLNX_VER_MIN(2,6,39)
     882static 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)
     888static 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 */
    882894static struct super_block *vbsf_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
    883895{
     
    885897    return get_sb_nodev(fs_type, flags, data, vbsf_read_super_26);
    886898}
    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
    900900
    901901/**
     
    905905    .owner = THIS_MODULE,
    906906    .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
    908910    .get_sb = vbsf_get_sb,
    909 # else
    910     .mount = sf_mount,
    911911# endif
    912912    .kill_sb = kill_anon_super
    913913};
    914914
    915 #else  /* LINUX_VERSION_CODE < 2.5.4 */
     915#else  /* < 2.5.4 */
    916916
    917917static struct super_block *vbsf_read_super_24(struct super_block *sb, void *data, int flags)
     
    931931static DECLARE_FSTYPE(g_vboxsf_fs_type, "vboxsf", vbsf_read_super_24, 0);
    932932
    933 #endif /* LINUX_VERSION_CODE < 2.5.4 */
     933#endif /* < 2.5.4 */
    934934
    935935
     
    10541054 * Module parameters.
    10551055 */
    1056 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 52)
     1056#if RTLNX_VER_MIN(2,5,52)
    10571057module_param_named(follow_symlinks, g_fFollowSymlinks, int, 0);
    10581058MODULE_PARM_DESC(follow_symlinks,
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h

    r82968 r85698  
    4646#include <VBox/log.h>
    4747
    48 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
     48#if RTLNX_VER_MIN(2,6,0)
    4949# include <linux/backing-dev.h>
    5050#endif
     
    8383 * inode compatibility glue.
    8484 */
    85 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
     85#if RTLNX_VER_MAX(2,6,0)
    8686
    8787DECLINLINE(loff_t) i_size_read(struct inode *pInode)
     
    9999#endif /* < 2.6.0 */
    100100
    101 #if  LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) \
     101#if  RTLNX_VER_MAX(3,2,0) \
    102102  && (!defined(RHEL_MAJOR) || RHEL_MAJOR != 6 || RHEL_MINOR < 10)
    103103DECLINLINE(void) set_nlink(struct inode *pInode, unsigned int cLinks)
     
    150150    /** Mount tag for VBoxService automounter.  @since 6.0 */
    151151    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)
    153153    /** The backing device info structure. */
    154154    struct backing_dev_info bdi;
     
    160160    /** The time to live for inode information in milliseconds, for /proc/mounts. */
    161161    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)
    163163    /** 4.0 and 4.1 are missing noop_backing_dev_info export, so take down the
    164164     *  initial value so we can restore it in vbsf_done_backing_dev(). (paranoia) */
     
    169169/* Following casts are here to prevent assignment of void * to
    170170   pointers of arbitrary type */
    171 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
     171#if RTLNX_VER_MAX(2,6,0)
    172172# define VBSF_GET_SUPER_INFO(sb)                ((struct vbsf_super_info *)(sb)->u.generic_sbp)
    173173# define VBSF_SET_SUPER_INFO(sb, a_pSuperInfo)  do { (sb)->u.generic_sbp = a_pSuperInfo; } while (0)
     
    249249};
    250250
    251 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) || defined(KERNEL_FC6)
     251#if RTLNX_VER_MIN(2,6,19) || defined(KERNEL_FC6)
    252252/* FC6 kernel 2.6.18, vanilla kernel 2.6.19+ */
    253253# define VBSF_GET_INODE_INFO(i)       ((struct vbsf_inode_info *) (i)->i_private)
     
    265265extern int  vbsf_inode_revalidate_worker(struct dentry *dentry, bool fForced, bool fInodeLocked);
    266266extern 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)
    269269extern int  vbsf_inode_getattr(const struct path *path, struct kstat *kstat, u32 request_mask, unsigned int query_flags);
    270270# else
     
    420420
    421421/** 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)
    423423# 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)
    425425# define VBSF_GET_F_DENTRY(f)   (f->f_path.dentry)
    426426#else
Note: See TracChangeset for help on using the changeset viewer.

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