Changeset 38901 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Sep 29, 2011 2:29:44 PM (13 years ago)
- Location:
- trunk/src/VBox/Additions/solaris/SharedFolders
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.c
r38854 r38901 97 97 #include "vboxfs_vfs.h" 98 98 99 #define VBOXVFS_WITH_MMAP 100 99 101 static struct vnodeops *sffs_ops = NULL; 100 102 … … 212 214 vp->v_vfsp = node->sf_sffs->sf_vfsp; 213 215 vn_setops(vp, sffs_ops); 214 vp->v_flag = VNOSWAP | VNOMAP; /* @todo -XXX- remove VNOMAP when ro-mmap is working*/ 216 vp->v_flag = VNOSWAP; 217 #ifndef VBOXVFS_WITH_MMAP 218 vp->v_flag |= VNOMAP; 219 #endif 215 220 vn_exists(vp); 216 221 vp->v_data = node; … … 1405 1410 } 1406 1411 1407 #if 01412 #ifdef VBOXVFS_WITH_MMAP 1408 1413 if (vn_vfswlock(vp)) { 1409 1414 VN_RELE(vp); … … 1457 1462 1458 1463 1459 #if 01464 #ifdef VBOXVFS_WITH_MMAP 1460 1465 static caddr_t 1461 1466 sffs_page_map( … … 1487 1492 * the file data into it. 1488 1493 */ 1489 int1494 static int 1490 1495 sffs_readpages( 1491 1496 vnode_t *dvp, … … 1509 1514 ASSERT(node->sf_file); 1510 1515 1511 cmn_err(CE_NOTE, "sffs_readpages\n");1512 1516 if (pagelistsize == PAGESIZE) 1513 1517 { 1514 1518 io_off = off; 1515 1519 io_len = PAGESIZE; 1516 1517 cmn_err(CE_NOTE, "sffs_readpages io_off=%lld io_len=%lld\n", (u_longlong_t)io_off, (u_longlong_t)io_len);1518 1519 1520 ppages = page_create_va(dvp, io_off, io_len, PG_WAIT | PG_EXCL, segp, addr); 1520 1521 } … … 1525 1526 if (!ppages) 1526 1527 { 1527 cmn_err(CE_NOTE, "sffs_readpages nothing done\n");1528 1528 *pagelist = NULL; 1529 1529 return (0); … … 1539 1539 ASSERT3U(io_off, ==, pcur->p_offset); 1540 1540 1541 cmn_err(CE_NOTE, "sffs_readpages page-by-page reading io_off=%lld\n", (u_longlong_t)io_off);1542 1541 caddr_t virtaddr = sffs_page_map(pcur, segaccess); 1543 1542 uint32_t bytes = PAGESIZE; 1544 1543 error = sfprov_read(node->sf_file, virtaddr, io_off, &bytes); 1545 1544 sffs_page_unmap(pcur, virtaddr); 1546 if (error != 0 || bytes < PAGESIZE)1545 if (error != 0) 1547 1546 { 1547 cmn_err(CE_WARN, "sffs_readpages: sfprov_read() failed. error=%d bytes=%ld\n", error, bytes); 1548 1548 /* Get rid of all kluster pages read & bail. */ 1549 1549 pvn_read_done(ppages, B_ERROR); … … 1559 1559 pvn_plist_init(ppages, pagelist, pagelistsize, off, io_len, segaccess); 1560 1560 ASSERT(pagelist == NULL || (*pagelist)->p_offset == off); 1561 cmn_err(CE_NOTE, "sffs_readpages done\n");1562 1563 1561 return (0); 1564 1562 } … … 1631 1629 } 1632 1630 1633 cmn_err(CE_NOTE, "sffs_getpage addr=%p len=%lld off=%lld\n", addr, (u_longlong_t)len, (u_longlong_t)off);1634 1631 while (*pagelist) 1635 1632 { … … 1661 1658 *pagelist = NULL; 1662 1659 mutex_exit(&sffs_lock); 1663 cmn_err(CE_NOTE, "sffs_getpage done\n");1664 1660 return (error); 1665 1661 } … … 1684 1680 */ 1685 1681 return (ENOSYS); 1682 } 1683 1684 1685 /*ARGSUSED*/ 1686 static int 1687 sffs_discardpage( 1688 vnode_t *dvp, 1689 page_t *ppage, 1690 u_offset_t *poff, 1691 size_t *plen, 1692 int flags, 1693 cred_t *pcred) 1694 { 1695 /* 1696 * We don't support PROT_WRITE mmaps. Just pretend we're done writing back 1697 * to the disk while unmounting/closing the node and discarding the mapped pages. 1698 */ 1699 pvn_write_done(ppage, B_INVAL | B_ERROR | B_FORCE); 1700 return (0); 1686 1701 } 1687 1702 … … 1795 1810 1796 1811 ASSERT(node); 1797 ASMAtomicAddU64(&node->sf_mapcnt, npages);1798 1812 return (0); 1799 1813 } … … 1823 1837 return (ENOSYS); 1824 1838 1825 ASSERT(node->sf_mapcnt >= npages);1826 ASMAtomicSubU64(&node->sf_mapcnt, npages);1827 1839 return (0); 1828 1840 } 1829 #endif 1841 #endif /* VBOXVFS_WITH_MMAP */ 1830 1842 1831 1843 … … 2004 2016 } 2005 2017 2006 /* 2007 * There should never be cached data, since we don't support mmap(). 2008 */ 2009 if (vn_has_cached_data(vp)) 2018 if (vn_has_cached_data(vp)) { 2019 #ifdef VBOXVFS_WITH_MMAP 2020 /* We're fine with releasing the vnode lock here as we should be covered by the sffs_lock */ 2021 mutex_exit(&vp->v_lock); 2022 pvn_vplist_dirty(vp, 0 /* offset */, sffs_discardpage, B_INVAL, cr); 2023 mutex_enter(&vp->v_lock); 2024 #else 2010 2025 panic("sffs_inactive() found cached data"); 2026 #endif 2027 } 2011 2028 2012 2029 /* … … 2137 2154 VOPNAME_WRITE, sffs_write, 2138 2155 2139 # if 02156 # ifdef VBOXVFS_WITH_MMAP 2140 2157 VOPNAME_MAP, sffs_map, 2141 2158 VOPNAME_ADDMAP, sffs_addmap, … … 2168 2185 VOPNAME_WRITE, { .vop_write = sffs_write }, 2169 2186 2170 # if 02187 # ifdef VBOXVFS_WITH_MMAP 2171 2188 VOPNAME_MAP, { .vop_map = sffs_map }, 2172 2189 VOPNAME_ADDMAP, { .vop_addmap = sffs_addmap }, -
trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.h
r37806 r38901 61 61 sffs_dirents_t *sf_dir_list; /* list of entries for this directory */ 62 62 sffs_stats_t *sf_dir_stats; /* file attrs for the above entries */ 63 #if 064 volatile uint64_t sf_mapcnt; /* number of mapped pages */65 #endif66 63 } sfnode_t; 67 64
Note:
See TracChangeset
for help on using the changeset viewer.