VirtualBox

Changeset 77940 in vbox for trunk


Ignore:
Timestamp:
Mar 28, 2019 4:03:06 PM (6 years ago)
Author:
vboxsync
Message:

linux/vboxsf: Reimplemented vbsf_splice_read to make both sendfile and splice() work more correctly on 2.6.23 - 2.6.30. [build fix] bugref:9172

File:
1 edited

Legend:

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

    r77939 r77940  
    4141# include <linux/buffer_head.h>
    4242#endif
    43 #if LINUX_VERSION_CODE <  KERNEL_VERSION(2, 6, 31) \
    44  && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 12)
     43#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 12) \
     44 && LINUX_VERSION_CODE <  KERNEL_VERSION(2, 6, 31)
    4545# include <linux/writeback.h>
    4646#endif
     
    4848 && LINUX_VERSION_CODE <  KERNEL_VERSION(2, 6, 31)
    4949# include <linux/splice.h>
     50#endif
     51#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) \
     52 && LINUX_VERSION_CODE <  KERNEL_VERSION(2, 6, 23)
     53# include <linux/pipe_fs_i.h>
    5054#endif
    5155#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 10)
     
    520524
    521525/*********************************************************************************************************************************
    522 *   Pipe / splice stuff for 2.6.23 >= linux < 2.6.31 (where no fallbacks were available)                                         *
     526*   Pipe / splice stuff for 2.6.17 >= linux < 2.6.31 (where no fallbacks were available)                                         *
    523527*********************************************************************************************************************************/
    524528
    525 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) \
     529#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) \
    526530 && LINUX_VERSION_CODE <  KERNEL_VERSION(2, 6, 31)
    527531
    528532
    529533/** Verify pipe buffer content (needed for page-cache to ensure idle page). */
    530 static int vbsf_pipe_buf_confirm(struct pipe_inode_info *info, struct pipe_buffer *pPipeBuf)
     534static int vbsf_pipe_buf_confirm(struct pipe_inode_info *pPipe, struct pipe_buffer *pPipeBuf)
    531535{
    532536    /*SFLOG3(("vbsf_pipe_buf_confirm: %p\n", pPipeBuf));*/
     
    535539
    536540/** Maps the buffer page. */
    537 static void *vbsf_pipe_buf_map(struct pipe_inode_info *pipe, struct pipe_buffer *pPipeBuf, int atomic)
     541static void *vbsf_pipe_buf_map(struct pipe_inode_info *pPipe, struct pipe_buffer *pPipeBuf, int atomic)
    538542{
    539543    void *pvRet;
     
    549553
    550554/** Unmaps the buffer page. */
    551 static void vbsf_pipe_buf_unmap(struct pipe_inode_info *pipe, struct pipe_buffer *pPipeBuf, void *pvMapping)
     555static void vbsf_pipe_buf_unmap(struct pipe_inode_info *pPipe, struct pipe_buffer *pPipeBuf, void *pvMapping)
    552556{
    553557    /*SFLOG3(("vbsf_pipe_buf_unmap: %p/%p\n", pPipeBuf, pvMapping)); */
     
    561565
    562566/** Gets a reference to the page. */
    563 static void vbsf_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *pPipeBuf)
     567static void vbsf_pipe_buf_get(struct pipe_inode_info *pPipe, struct pipe_buffer *pPipeBuf)
    564568{
    565569    page_cache_get(pPipeBuf->page);
     
    568572
    569573/** Release the buffer page (counter to vbsf_pipe_buf_get). */
    570 static void vbsf_pipe_buf_release(struct pipe_inode_info *pipe, struct pipe_buffer *pPipeBuf)
     574static void vbsf_pipe_buf_release(struct pipe_inode_info *pPipe, struct pipe_buffer *pPipeBuf)
    571575{
    572576    /*SFLOG3(("vbsf_pipe_buf_release: %p (incoming count=%d)\n", pPipeBuf, page_count(pPipeBuf->page)));*/
     
    576580/** Attempt to steal the page.
    577581 * @returns 0 success, 1 on failure.  */
    578 static int vbsf_pipe_buf_steal(struct pipe_inode_info *pipe, struct pipe_buffer *pPipeBuf)
     582static int vbsf_pipe_buf_steal(struct pipe_inode_info *pPipe, struct pipe_buffer *pPipeBuf)
    579583{
    580584    if (page_count(pPipeBuf->page) == 1) {
     
    604608};
    605609
    606 # define LOCK_PIPE(pipe)   do { if ((pipe)->inode) mutex_lock(&(pipe)->inode->i_mutex); } while (0)
    607 # define UNLOCK_PIPE(pipe) do { if ((pipe)->inode) mutex_unlock(&(pipe)->inode->i_mutex); } while (0)
     610# define LOCK_PIPE(a_pPipe)   do { if ((a_pPipe)->inode) mutex_lock(&(a_pPipe)->inode->i_mutex); } while (0)
     611# define UNLOCK_PIPE(a_pPipe) do { if ((a_pPipe)->inode) mutex_unlock(&(a_pPipe)->inode->i_mutex); } while (0)
    608612
    609613/** Waits for the pipe buffer status to change. */
     
    796800}
    797801
    798 #endif /* 2.6.23 <= LINUX_VERSION_CODE < 2.6.31 */
     802#endif /* 2.6.17 <= LINUX_VERSION_CODE < 2.6.31 */
    799803
    800804
     
    29652969    .mmap            = generic_file_mmap,
    29662970#endif
    2967 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17)
     2971#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
    29682972    .splice_read     = vbsf_splice_read,
    29692973    /// @todo .splice_write    = vbsf_splice_write,
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