~ubuntu-branches/ubuntu/vivid/virtualbox-ose/vivid

« back to all changes in this revision

Viewing changes to src/VBox/Additions/linux/sharedfolders/utils.c

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2010-03-11 17:16:37 UTC
  • mfrom: (0.3.4 upstream) (0.4.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100311171637-43z64ia3ccpj8vqn
Tags: 3.1.4-dfsg-2ubuntu1
* Merge from Debian unstable (LP: #528561), remaining changes:
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
  - Replace *-source packages with transitional packages for *-dkms
* Fix crash in vboxvideo_drm with kernel 2.6.33 / backported drm code
  (LP: #535297)
* Add a list of linux-headers packages to the apport hook
* Update debian/patches/u02-lp-integration.dpatch with a
  DEP-3 compliant header
* Add ${misc:Depends} to virtualbox-ose-source and virtualbox-ose-guest-source
  Depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
/* #define USE_VMALLOC */
29
29
 
30
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
31
30
/*
32
31
 * sf_reg_aops and sf_backing_dev_info are just quick implementations to make
33
32
 * sendfile work. For more information have a look at
39
38
 *   http://pserver.samba.org/samba/ftp/cifs-cvs/samplefs.tar.gz
40
39
 */
41
40
 
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
 
 
54
41
#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 0)
55
42
static void
56
43
sf_ftime_from_timespec (time_t *time, RTTIMESPEC *ts)
120
107
 
121
108
#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
122
109
        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;
124
111
#endif
125
112
 
126
113
        if (is_dir) {
811
798
struct dentry_operations sf_dentry_ops = {
812
799
        .d_revalidate = sf_dentry_revalidate
813
800
};
 
801
 
 
802
int 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 LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 26)
 
818
    if (!rc)
 
819
        rc = bdi_register(&sf_g->bdi, NULL, "vboxvfs-%s", name);
 
820
#  endif /* >= 2.6.26 */
 
821
# endif /* >= 2.6.24 */
 
822
#endif /* >= 2.6.0 */
 
823
    return rc;
 
824
}
 
825
 
 
826
void sf_done_backing_dev(struct sf_glob_info *sf_g)
 
827
{
 
828
#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 24)
 
829
    bdi_destroy(&sf_g->bdi); /* includes bdi_unregister() */
 
830
#endif
 
831
}