VirtualBox

Changeset 76744 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jan 9, 2019 4:29:03 PM (6 years ago)
Author:
vboxsync
Message:

vboxsf/linux: Indent #ifdefs and comment the according to our guidelines, no need to make this harder to untangle than it already is.

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

Legend:

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

    r76733 r76744  
    11/* $Id$ */
    22/** @file
    3  * vboxsf - VBox Linux Shared Folders VFS, directory inode and file operations
     3 * vboxsf - VBox Linux Shared Folders VFS, directory inode and file operations.
    44 */
    55
     
    352352        .read = generic_read_dir
    353353#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
    354             ,.llseek = generic_file_llseek
     354        , .llseek = generic_file_llseek
    355355#endif
    356356};
     
    875875        return err;
    876876}
    877 #endif
     877#endif /* LINUX_VERSION_CODE >= 2.6.0 */
    878878
    879879struct inode_operations sf_dir_iops = {
  • trunk/src/VBox/Additions/linux/sharedfolders/lnkops.c

    r76733 r76744  
    3333#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    3434
    35 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
    36 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
     35# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
     36#  if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
    3737static const char *sf_follow_link(struct dentry *dentry, void **cookie)
    38 #else
     38#  else
    3939static void *sf_follow_link(struct dentry *dentry, struct nameidata *nd)
    40 #endif
     40#  endif
    4141{
    4242        struct inode *inode = dentry->d_inode;
     
    5757                }
    5858        }
    59 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
     59#  if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
    6060        return error ? ERR_PTR(error) : (*cookie = path);
    61 #else
     61#  else
    6262        nd_set_link(nd, error ? ERR_PTR(error) : path);
    6363        return NULL;
    64 #endif
     64#  endif
    6565}
    6666
    67 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
     67#  if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
    6868static void sf_put_link(struct dentry *dentry, struct nameidata *nd,
    6969                        void *cookie)
     
    7373                free_page((unsigned long)page);
    7474}
    75 #endif
     75#  endif
    7676
    77 #else                           /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) */
     77# else  /* LINUX_VERSION_CODE >= 4.5.0 */
    7878static const char *sf_get_link(struct dentry *dentry, struct inode *inode,
    7979                               struct delayed_call *done)
     
    100100        return path;
    101101}
    102 #endif                          /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) */
     102# endif /* LINUX_VERSION_CODE >= 4.5.0 */
    103103
    104104struct inode_operations sf_lnk_iops = {
    105 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
     105# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
    106106        .readlink = generic_readlink,
    107 #endif
    108 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
     107# endif
     108# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
    109109        .get_link = sf_get_link
    110 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
     110# elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
    111111        .follow_link = sf_follow_link,
    112112        .put_link = free_page_put_link,
    113 #else
     113# else
    114114        .follow_link = sf_follow_link,
    115115        .put_link = sf_put_link
    116 #endif
     116# endif
    117117};
    118118
    119 #endif                          /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) */
     119#endif  /* LINUX_VERSION_CODE >= 2.6.0 */
  • trunk/src/VBox/Additions/linux/sharedfolders/regops.c

    r76736 r76744  
    11/* $Id$ */
    22/** @file
    3  * vboxsf - VBox Linux Shared Folders VFS, Regular file inode and file operations.
     3 * vboxsf - VBox Linux Shared Folders VFS, regular file inode and file operations.
    44 */
    55
     
    102102}
    103103
    104 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) && \
    105    LINUX_VERSION_CODE <  KERNEL_VERSION(2, 6, 31)
     104#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) \
     105 && LINUX_VERSION_CODE <  KERNEL_VERSION(2, 6, 31)
    106106
    107107void free_pipebuf(struct page *kpage)
     
    254254}
    255255
    256 #endif
     256#endif /* 2.6.23 <= LINUX_VERSION_CODE < 2.6.31 */
    257257
    258258/**
     
    596596static struct page *sf_reg_nopage(struct vm_area_struct *vma,
    597597                                  unsigned long vaddr, int *type)
    598 #define SET_TYPE(t) *type = (t)
    599 #else                           /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) */
     598# define SET_TYPE(t) *type = (t)
     599#else  /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) */
    600600static struct page *sf_reg_nopage(struct vm_area_struct *vma,
    601601                                  unsigned long vaddr, int unused)
    602 #define SET_TYPE(t)
     602# define SET_TYPE(t)
    603603#endif
    604604{
     
    709709        .mmap = sf_reg_mmap,
    710710#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    711 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
     711# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
    712712/** @todo This code is known to cause caching of data which should not be
    713713 * cached.  Investigate. */
    714 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
     714# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
    715715        .splice_read = sf_splice_read,
    716 #else
     716# else
    717717        .sendfile = generic_file_sendfile,
    718 #endif
     718# endif
    719719        .aio_read = generic_file_aio_read,
    720720        .aio_write = generic_file_aio_write,
    721 #endif
    722 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
     721# endif
     722# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
    723723        .fsync = noop_fsync,
    724 #else
     724# else
    725725        .fsync = simple_sync_file,
    726 #endif
     726# endif
    727727        .llseek = generic_file_llseek,
    728728#endif
     
    739739
    740740#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
     741
    741742static int sf_readpage(struct file *file, struct page *page)
    742743{
     
    809810}
    810811
    811 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
     812# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
     813
    812814int sf_write_begin(struct file *file, struct address_space *mapping, loff_t pos,
    813815                   unsigned len, unsigned flags, struct page **pagep,
     
    848850
    849851        unlock_page(page);
    850 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
     852#  if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
    851853        put_page(page);
    852 #else
     854#  else
    853855        page_cache_release(page);
    854 #endif
     856#  endif
    855857
    856858        return nwritten;
    857859}
    858860
    859 #endif                          /* KERNEL_VERSION >= 2.6.24 */
     861# endif /* KERNEL_VERSION >= 2.6.24 */
    860862
    861863struct address_space_operations sf_reg_aops = {
    862864        .readpage = sf_readpage,
    863865        .writepage = sf_writepage,
    864 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
     866# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
    865867        .write_begin = sf_write_begin,
    866868        .write_end = sf_write_end,
    867 #else
     869# else
    868870        .prepare_write = simple_prepare_write,
    869871        .commit_write = simple_commit_write,
    870 #endif
     872# endif
    871873};
    872 #endif
     874
     875#endif /* LINUX_VERSION_CODE >= 2.6.0 */
     876
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c

    r76733 r76744  
    279279         * correct limit but MAX_LFS_FILESIZE (8TB-1 on 32-bit boxes) takes the
    280280         * page cache into account and is the suggested limit. */
    281 #if defined MAX_LFS_FILESIZE
     281# if defined MAX_LFS_FILESIZE
    282282        sb->s_maxbytes = MAX_LFS_FILESIZE;
    283 #else
     283# else
    284284        sb->s_maxbytes = 0x7fffffffffffffffULL;
    285 #endif
     285# endif
    286286#endif
    287287        sb->s_op = &sf_super_ops;
     
    384384        SET_INODE_INFO(inode, NULL);
    385385}
    386 #else
     386#else  /* LINUX_VERSION_CODE >= 2.6.36 */
    387387static void sf_evict_inode(struct inode *inode)
    388388{
     
    391391        TRACE();
    392392        truncate_inode_pages(&inode->i_data, 0);
    393 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
     393# if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
    394394        clear_inode(inode);
    395 #else
     395# else
    396396        end_writeback(inode);
    397 #endif
     397# endif
    398398
    399399        sf_i = GET_INODE_INFO(inode);
     
    406406        SET_INODE_INFO(inode, NULL);
    407407}
    408 #endif
     408#endif /* LINUX_VERSION_CODE >= 2.6.36 */
    409409
    410410/* this is called by vfs when it wants to populate [inode] with data.
     
    492492        /*unlock_new_inode(iroot); */
    493493        return 0;
    494 #else
     494#else  /* LINUX_VERSION_CODE < 2.4.23 */
    495495        return -ENOSYS;
    496 #endif
     496#endif /* LINUX_VERSION_CODE < 2.4.23 */
    497497}
    498498
     
    552552}
    553553
    554 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
     554# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
    555555static struct super_block *sf_get_sb(struct file_system_type *fs_type,
    556556                                     int flags, const char *dev_name,
     
    560560        return get_sb_nodev(fs_type, flags, data, sf_read_super_26);
    561561}
    562 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
     562# elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
    563563static int sf_get_sb(struct file_system_type *fs_type, int flags,
    564564                     const char *dev_name, void *data, struct vfsmount *mnt)
     
    567567        return get_sb_nodev(fs_type, flags, data, sf_read_super_26, mnt);
    568568}
    569 #else
     569# else /* LINUX_VERSION_CODE >= 2.6.39 */
    570570static struct dentry *sf_mount(struct file_system_type *fs_type, int flags,
    571571                               const char *dev_name, void *data)
     
    574574        return mount_nodev(fs_type, flags, data, sf_read_super_26);
    575575}
    576 #endif
     576# endif /* LINUX_VERSION_CODE >= 2.6.39 */
    577577
    578578static struct file_system_type vboxsf_fs_type = {
    579579        .owner = THIS_MODULE,
    580580        .name = "vboxsf",
    581 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
     581# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
    582582        .get_sb = sf_get_sb,
    583 #else
     583# else
    584584        .mount = sf_mount,
    585 #endif
     585# endif
    586586        .kill_sb = kill_anon_super
    587587};
    588 #endif
     588
     589#endif /* LINUX_VERSION_CODE >= 2.6.0 */
    589590
    590591#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
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