VirtualBox

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


Ignore:
Timestamp:
Jan 29, 2010 2:46:26 PM (15 years ago)
Author:
vboxsync
Message:

Another fix for public #5891. Thanks to Pax Team for the suggestion.

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

Legend:

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

    r25637 r26102  
    2828/* #define USE_VMALLOC */
    2929
    30 #if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
    3130/*
    3231 * sf_reg_aops and sf_backing_dev_info are just quick implementations to make
     
    4039 */
    4140
    42 static struct backing_dev_info sf_backing_dev_info = {
    43         .ra_pages      = 0, /* No readahead */
    44 # if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 12)
    45         .capabilities  = BDI_CAP_MAP_DIRECT    /* MAP_SHARED */
    46                        | BDI_CAP_MAP_COPY      /* MAP_PRIVATE */
    47                        | BDI_CAP_READ_MAP      /* can be mapped for reading */
    48                        | BDI_CAP_WRITE_MAP     /* can be mapped for writing */
    49                        | BDI_CAP_EXEC_MAP,     /* can be mapped for execution */
    50 # endif
    51 };
    52 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0) */
    53 
    5441#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 0)
    5542static void
     
    121108#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
    122109        inode->i_mapping->a_ops = &sf_reg_aops;
    123         inode->i_mapping->backing_dev_info = &sf_backing_dev_info;
     110        inode->i_mapping->backing_dev_info = &sf_g->bdi;
    124111#endif
    125112
     
    813800};
    814801
    815 void sf_init_backing_dev(void)
     802int sf_init_backing_dev(struct sf_glob_info *sf_g, const char *name)
     803{
     804    int rc = 0;
     805
     806#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
     807    sf_g->bdi.ra_pages = 0; /* No readahead */
     808# if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 12)
     809    sf_g->bdi.capabilities  = BDI_CAP_MAP_DIRECT    /* MAP_SHARED */
     810                            | BDI_CAP_MAP_COPY      /* MAP_PRIVATE */
     811                            | BDI_CAP_READ_MAP      /* can be mapped for reading */
     812                            | BDI_CAP_WRITE_MAP     /* can be mapped for writing */
     813                            | BDI_CAP_EXEC_MAP;     /* can be mapped for execution */
     814# endif /* >= 2.6.12 */
     815# if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 24)
     816    rc = bdi_init(&sf_g->bdi);
     817    if (!rc)
     818        rc = bdi_register(&sf_g->bdi, NULL, "vboxvfs-%s", name);
     819# endif /* >= 2.6.24 */
     820#endif /* >= 2.6.0 */
     821    return rc;
     822}
     823
     824void sf_done_backing_dev(struct sf_glob_info *sf_g)
    816825{
    817826#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 24)
    818     bdi_init(&sf_backing_dev_info);
    819 #endif
    820 }
     827    bdi_destroy(&sf_g->bdi);
     828#endif
     829}
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c

    r25637 r26102  
    287287        }
    288288
     289        if (sf_init_backing_dev(sf_g, info->name)) {
     290                err = -EINVAL;
     291                LogFunc(("could not init bdi\n"));
     292                goto fail4;
     293        }
     294
    289295        sf_init_inode (sf_g, iroot, &fsinfo);
    290296        SET_INODE_INFO (iroot, sf_i);
     
    298304                err = -ENOMEM;  /* XXX */
    299305                LogFunc(("d_alloc_root failed\n"));
    300                 goto fail4;
     306                goto fail5;
    301307        }
    302308
     
    305311        return 0;
    306312
     313 fail5:
     314        sf_done_backing_dev(sf_g);
    307315 fail4:
    308316        iput (iroot);
     
    372380        sf_g = GET_GLOB_INFO (sb);
    373381        BUG_ON (!sf_g);
     382        sf_done_backing_dev(sf_g);
    374383        sf_glob_free (sf_g);
    375384}
     
    468477        }
    469478
    470         sf_init_backing_dev();
    471 
    472479        err = register_filesystem (&vboxsf_fs_type);
    473480        if (err) {
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h

    r25637 r26102  
    2626#include "version-generated.h"
    2727
     28#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
     29# include <linux/backing-dev.h>
     30#endif
     31
    2832#include "VBoxCalls.h"
    2933#include "vbsfmount.h"
     
    4044        int dmask;
    4145        int fmask;
     46#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
     47        struct backing_dev_info bdi;
     48#endif
    4249};
    4350
     
    108115sf_dir_read_all (struct sf_glob_info *sf_g, struct sf_inode_info *sf_i,
    109116                 struct sf_dir_info *sf_d, SHFLHANDLE handle);
     117extern int
     118sf_init_backing_dev (struct sf_glob_info *sf_g, const char *name);
    110119extern void
    111 sf_init_backing_dev(void);
     120sf_done_backing_dev (struct sf_glob_info *sf_g);
    112121
    113122#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