VirtualBox

Changeset 5984 in vbox


Ignore:
Timestamp:
Dec 6, 2007 1:06:54 PM (17 years ago)
Author:
vboxsync
Message:

Linux Additions: implemented a simple sendfile using Linux kernel defaults. This should fix web servers accessing shared folders.

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

Legend:

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

    r5259 r5984  
    390390
    391391struct file_operations sf_reg_fops = {
    392         .read    = sf_reg_read,
    393         .open    = sf_reg_open,
    394         .write   = sf_reg_write,
    395         .release = sf_reg_release,
    396         .mmap    = sf_reg_mmap
     392        .read     = sf_reg_read,
     393        .open     = sf_reg_open,
     394        .write    = sf_reg_write,
     395        .release  = sf_reg_release,
     396        .mmap     = sf_reg_mmap,
     397#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
     398        .sendfile = generic_file_sendfile,
     399        .fsync    = simple_sync_file,
     400#endif
    397401};
    398402
  • trunk/src/VBox/Additions/linux/sharedfolders/utils.c

    r5016 r5984  
    2424/* #define USE_VMALLOC */
    2525
     26#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
     27/*
     28 * sf_aops and sf_backing_dev_info are just quick implementations to make
     29 * sendfile work. For more information have a look at
     30 *
     31 *   http://us1.samba.org/samba/ftp/cifs-cvs/ols2006-fs-tutorial-smf.odp
     32 *
     33 * and the sample implementation
     34 *
     35 *   http://pserver.samba.org/samba/ftp/cifs-cvs/samplefs.tar.gz
     36 */
     37static struct address_space_operations sf_aops = {
     38        .readpage      = simple_readpage,
     39        .prepare_write = simple_prepare_write,
     40        .commit_write  = simple_commit_write,
     41};
     42
     43static struct backing_dev_info sf_backing_dev_info = {
     44        .ra_pages      = 0, /* No readahead */
     45# if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 12)
     46        .capabilities  = BDI_CAP_MAP_DIRECT    /* MAP_SHARED */
     47                       | BDI_CAP_MAP_COPY      /* MAP_PRIVATE */
     48                       | BDI_CAP_READ_MAP      /* can be mapped for reading */
     49                       | BDI_CAP_WRITE_MAP     /* can be mapped for writing */
     50                       | BDI_CAP_EXEC_MAP,     /* can be mapped for execution */
     51# endif
     52};
     53#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0) */
     54
    2655#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 0)
    2756static void
     
    76105        mode |= mode_set (IXOTH);
    77106#undef mode_set
     107
     108#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
     109        inode->i_mapping->a_ops = &sf_aops;
     110        inode->i_mapping->backing_dev_info = &sf_backing_dev_info;
     111#endif
    78112
    79113        if (is_dir) {
     
    95129        inode->i_gid = sf_g->gid;
    96130        inode->i_size = info->cbObject;
    97 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) && !defined(KERNEL_FC6)
     131#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 19) && !defined(KERNEL_FC6)
    98132        inode->i_blksize = 4096;
    99133#endif
    100 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,11)
     134#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 4, 11)
    101135        inode->i_blkbits = 12;
    102136#endif
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h

    r4909 r5984  
    118118#endif
    119119
    120 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) || defined(KERNEL_FC6)
     120#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 19) || defined(KERNEL_FC6)
    121121/* FC6 kernel 2.6.18, vanilla kernel 2.6.19+ */
    122122#define GET_INODE_INFO(i) ((struct sf_inode_info *) (i)->i_private)
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