VirtualBox

Changeset 90582 in vbox


Ignore:
Timestamp:
Aug 9, 2021 8:23:33 PM (4 years ago)
Author:
vboxsync
Message:

linux/vboxsf: Avoid making the code even more spaghetti-like, indentation fixes and comments. (How difficult can this be?) bugref:10066

File:
1 edited

Legend:

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

    r90497 r90582  
    7575#if RTLNX_VER_MAX(2,5,12)
    7676# define PageUptodate(a_pPage) Page_Uptodate(a_pPage)
     77#endif
     78
     79
     80/*********************************************************************************************************************************
     81*   Defined Constants And Macros                                                                                                 *
     82*********************************************************************************************************************************/
     83/** @def  VBSF_GET_ITER_TYPE
     84 * Accessor for getting iov iter type member which changed name in 5.14. */
     85#if RTLNX_VER_MIN(5,14,0)
     86# define VBSF_GET_ITER_TYPE(a_pIter) ((a_pIter)->iter_type)
     87#else
     88# define VBSF_GET_ITER_TYPE(a_pIter) ((a_pIter)->iter)
    7789#endif
    7890
     
    21272139
    21282140    Assert(iov_iter_count(iter) + pStash->cb > 0);
    2129 # if RTLNX_VER_MIN(5,14,0)
    2130     if (!(iter->iter_type & ITER_KVEC)) {
    2131 #else
    2132     if (!(iter->type & ITER_KVEC)) {
    2133 #endif
     2141    if (!(VBSF_GET_ITER_TYPE(iter) & ITER_KVEC)) {
    21342142        /*
    21352143         * Do we have a stashed page?
     
    23772385{
    23782386    size_t cPages;
    2379 #if RTLNX_VER_MIN(5,14,0)
    2380     if (iter_is_iovec(iter) || (iter->iter_type & ITER_KVEC)) {
    2381 #elif RTLNX_VER_MIN(3,16,0)
    2382     if (iter_is_iovec(iter) || (iter->type & ITER_KVEC)) {
    2383 #endif
     2387# if RTLNX_VER_MIN(3,16,0)
     2388    if (iter_is_iovec(iter) || (VBSF_GET_ITER_TYPE(iter) & ITER_KVEC)) {
     2389# endif
    23842390        const struct iovec *pCurIov    = iter->iov;
    23852391        size_t              cLeft      = iter->nr_segs;
     
    24432449        /* Won't bother with accurate counts for the next two types, just make
    24442450           some rough estimates (does pipes have segments?): */
    2445 #  if RTLNX_VER_MIN(5,14,0)
    2446         size_t cSegs = iter->iter_type & ITER_BVEC ? RT_MAX(1, iter->nr_segs) : 1;
    2447 #  else
    2448         size_t cSegs = iter->type & ITER_BVEC ? RT_MAX(1, iter->nr_segs) : 1;
    2449 #endif
     2451        size_t cSegs = VBSF_GET_ITER_TYPE(iter) & ITER_BVEC ? RT_MAX(1, iter->nr_segs) : 1;
    24502452        cPages = (iov_iter_count(iter) + (PAGE_SIZE * 2 - 2) * cSegs) >> PAGE_SHIFT;
    24512453    }
     
    25992601    struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
    26002602
    2601 #if RTLNX_VER_MIN(5,14,0)
    26022603    SFLOGFLOW(("vbsf_reg_read_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n",
    2603                inode, kio->ki_filp, cbToRead, kio->ki_pos, iter->iter_type));
    2604 #else
    2605     SFLOGFLOW(("vbsf_reg_read_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n",
    2606                inode, kio->ki_filp, cbToRead, kio->ki_pos, iter->type));
    2607 #endif
    2608 
     2604               inode, kio->ki_filp, cbToRead, kio->ki_pos, VBSF_GET_ITER_TYPE(iter) ));
    26092605    AssertReturn(S_ISREG(inode->i_mode), -EINVAL);
    26102606
     
    28402836# endif
    28412837
    2842 #if RTLNX_VER_MIN(5,14,0)
     2838
    28432839    SFLOGFLOW(("vbsf_reg_write_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n",
    2844                inode, kio->ki_filp, cbToWrite, offFile, iter->iter_type));
    2845 #else
    2846     SFLOGFLOW(("vbsf_reg_write_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n",
    2847                inode, kio->ki_filp, cbToWrite, offFile, iter->type));
    2848 #endif
     2840               inode, kio->ki_filp, cbToWrite, offFile, VBSF_GET_ITER_TYPE(iter) ));
    28492841    AssertReturn(S_ISREG(inode->i_mode), -EINVAL);
    28502842
     
    37593751
    37603752#if RTLNX_VER_MIN(5,14,0)
     3753/**
     3754 * Companion to vbsf_write_begin (i.e. shouldn't be called).
     3755 */
    37613756static int vbsf_write_end(struct file *file, struct address_space *mapping,
    3762                 loff_t pos, unsigned int len, unsigned int copied,
    3763                 struct page *page, void *fsdata)
     3757                          loff_t pos, unsigned int len, unsigned int copied,
     3758                          struct page *page, void *fsdata)
    37643759{
    37653760    static uint64_t volatile s_cCalls = 0;
     
    37743769# endif
    37753770    }
    3776 
    37773771    return -ENOTSUPP;
    37783772}
    3779 #endif
     3773#endif /* KERNEL_VERSION >= 5.14.0 */
     3774
    37803775
    37813776#if RTLNX_VER_MIN(2,4,10)
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