VirtualBox

Changeset 30527 in vbox


Ignore:
Timestamp:
Jun 30, 2010 1:11:55 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
63234
Message:

Additions/Solaris/SharedFolders: optionally honor fsync requests from the guest.

Location:
trunk/src/VBox/Additions/solaris/SharedFolders
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_mount.c

    r30519 r30527  
    5454           "     gid=GID            set the default file owner group id to GID\n"
    5555           "     stat_ttl=TTL       set the \"time to live\" (in ms) for the stat caches (default %d)\n"
     56           "     fsync              honor fsync calls instead of ignoring them\n"
    5657           "     ttl=TTL            set the \"time to live\" to TID for the dentry\n"
    5758           "     iocharset CHARSET  use the character set CHARSET for i/o operations (default utf8)\n"
  • trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.c

    r30519 r30527  
    378378        if (RT_FAILURE(rc))
    379379                return (EINVAL);
     380        return (0);
     381}
     382
     383int
     384sfprov_fsync(sfp_file_t *fp)
     385{
     386        int rc;
     387
     388        rc = vboxCallFlush(&vbox_client, &fp->map, fp->handle);
     389        if (RT_FAILURE(rc))
     390                return (EIO);
    380391        return (0);
    381392}
  • trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.h

    r30519 r30527  
    8484extern int sfprov_write(sfp_file_t *, char * buffer, uint64_t offset,
    8585    uint32_t *numbytes);
     86extern int sfprov_fsync(sfp_file_t *fp);
    8687
    8788
  • trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.c

    r30519 r30527  
    6666        {"uid",         NULL,           NULL,   MO_HASVALUE,    NULL},
    6767        {"gid",         NULL,           NULL,   MO_HASVALUE,    NULL},
    68         {"stat_ttl",    NULL,           NULL,   MO_HASVALUE,    NULL}
     68        {"stat_ttl",    NULL,           NULL,   MO_HASVALUE,    NULL},
     69        {"fsync",       NULL,           NULL,   0,              NULL}
    6970};
    7071
     
    230231        gid_t gid = 0;
    231232        int stat_ttl = DEF_STAT_TTL_MS;
     233        int fsync = 0;
    232234        char *optval;
    233235        long val;
     
    298300            (int)val == val)
    299301                stat_ttl = val;
     302
     303        /*
     304         * whether to honor fsync
     305         */
     306        if (vfs_optionisset(vfsp, "fsync", &optval))
     307                fsync = 1;
    300308
    301309        /*
     
    351359        sffs->sf_gid = gid;
    352360        sffs->sf_stat_ttl = stat_ttl;
     361        sffs->sf_fsync = fsync;
    353362        sffs->sf_share_name = share_name;
    354363        sffs->sf_mntpath = mount_point;
  • trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.h

    r30519 r30527  
    3232        gid_t           sf_gid;         /* group of all shared folders */
    3333        int             sf_stat_ttl;    /* ttl for stat caches (in ms) */
     34        int             sf_fsync;       /* whether to honor fsync or not */
    3435        char            *sf_share_name;
    3536        char            *sf_mntpath;    /* name of mount point */
  • trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.c

    r30519 r30527  
    15601560sffs_fsync(vnode_t *vp, int flag, cred_t *cr, caller_context_t *ct)
    15611561{
    1562 #if 0
    15631562        sfnode_t *node;
     1563        int             error;
    15641564
    15651565        /*
    15661566         * Ask the host to sync any data it may have cached for open files.
    1567          * I don't think we care about errors.
    15681567         */
    15691568        mutex_enter(&sffs_lock);
    15701569        node = VN2SFN(vp);
    1571         if (node->sf_file != NULL)
    1572                 (void) sfprov_fsync(node->sf_file);
     1570        if (node->sf_file == NULL)
     1571                error = EBADF;
     1572        else if (node->sf_sffs->sf_fsync)
     1573                error = sfprov_fsync(node->sf_file);
     1574        else
     1575                error = 0;
    15731576        mutex_exit(&sffs_lock);
    1574 #endif
    1575         return (0);
     1577        return (error);
    15761578}
    15771579
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