Changeset 37806 in vbox
- Timestamp:
- Jul 6, 2011 3:11:02 PM (14 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
r37776 r37806 68 68 69 69 #include <VBox/log.h> 70 #include <iprt/asm.h> 70 71 71 72 #include <unistd.h> … … 82 83 #include <sys/sunddi.h> 83 84 #include <sys/vfs.h> 85 #include <sys/vmsystm.h> 84 86 #if !defined(VBOX_VFS_SOLARIS_10U6) 85 87 #include <sys/vfs_opreg.h> … … 1453 1455 1454 1456 1457 #if 0 1458 /*ARGSUSED*/ 1459 static int 1460 sffs_getpage( 1461 vnode_t *dvp, 1462 offset_t off, 1463 size_t len, 1464 uint_t *protp, 1465 page_t *pagelist[], 1466 size_t pagelistsize, 1467 struct seg *segp, 1468 caddr_t addr, 1469 enum seg_rw segaccess, 1470 cred_t *credp 1471 #if !defined(VBOX_VFS_SOLARIS_10U6) 1472 , caller_context_t *ct 1473 #endif 1474 ) 1475 { 1476 } 1477 1478 1479 /*ARGSUSED*/ 1480 static int 1481 sffs_putpage( 1482 vnode_t *dvp, 1483 offset_t off, 1484 size_t len, 1485 int flags, 1486 cred_t *credp 1487 #if !defined(VBOX_VFS_SOLARIS_10U6) 1488 , caller_context_t *ct 1489 #endif 1490 ) 1491 { 1492 } 1493 1494 1495 /*ARGSUSED*/ 1496 static int 1497 sffs_map( 1498 vnode_t *dvp, 1499 offset_t off, 1500 struct as *asp, 1501 caddr_t *addrp, 1502 size_t len, 1503 uchar_t prot, 1504 uchar_t maxprot, 1505 uint_t flags, 1506 cred_t *credp 1507 #if !defined(VBOX_VFS_SOLARIS_10U6) 1508 , caller_context_t *ct 1509 #endif 1510 ) 1511 { 1512 /* 1513 * Invocation: mmap()-smmap_common()->VOP_MAP()->sffs_map(). Once the segment driver 1514 * creates the new segment in segvn_create(), it'll invoke down the line VOP_ADDMAP()->sffs_addmap() 1515 */ 1516 int error; 1517 if ((prot & PROT_WRITE)) 1518 return (ENOTSUP); 1519 1520 if (off < 0 || len > MAXOFFSET_T - off) 1521 return (ENXIO); 1522 1523 if (dvp->v_type != VREG) 1524 return (ENODEV); 1525 1526 if (dvp->v_flag & VNOMAP) 1527 return (ENOSYS); 1528 1529 mutex_enter(&sffs_lock); 1530 as_rangelock(asp); 1531 1532 error = choose_addr(asp, addrp, len, off, ADDR_VACALIGN, flags); 1533 if (!error) 1534 { 1535 segvn_crargs_t vnodeargs; 1536 memset(&vnodeargs, 0, sizeof(vnodeargs)); 1537 vnodeargs.vp = dvp; 1538 vnodeargs.cred = credp; 1539 vnodeargs.offset = off; 1540 vnodeargs.type = flags & MAP_TYPE; 1541 vnodeargs.prot = prot; 1542 vnodeargs.maxprot = maxprot; 1543 vnodeargs.flags = flags & ~MAP_TYPE; 1544 vnodeargs.amp = NULL; /* anon. mapping */ 1545 vnodeargs.szc = 0; /* preferred page size code */ 1546 vnodeargs.lgrp_mem_policy_flags = 0; 1547 1548 error = as_map(asp, *addrp, len, segvn_create, &vnodeargs); 1549 } 1550 1551 as_rangeunlock(asp); 1552 mutex_exit(&sffs_lock); 1553 1554 return (error); 1555 } 1556 1557 1558 /*ARGSUSED*/ 1559 static int 1560 sffs_addmap( 1561 vnode_t *dvp, 1562 offset_t off, 1563 struct as *asp, 1564 caddr_t addr, 1565 size_t len, 1566 uchar_t prot, 1567 uchar_t maxprot, 1568 uint_t flags, 1569 cred_t *credp 1570 #if !defined(VBOX_VFS_SOLARIS_10U6) 1571 , caller_context_t *ct 1572 #endif 1573 ) 1574 { 1575 sfnode_t *node = VN2SFN(dvp); 1576 uint64_t npages = btopr(len); 1577 1578 ASSERT(node); 1579 ASMAtomicAddU64(&node->sf_mapcnt, npages); 1580 return (0); 1581 } 1582 1583 1584 /*ARGSUSED*/ 1585 static int 1586 sffs_delmap( 1587 vnode_t *dvp, 1588 offset_t off, 1589 struct as *asp, 1590 caddr_t addr, 1591 size_t len, 1592 uint_t prot, 1593 uint_t maxprot, 1594 uint_t flags, 1595 cred_t *credp 1596 #if !defined(VBOX_VFS_SOLARIS_10U6) 1597 , caller_context_t *ct 1598 #endif 1599 ) 1600 { 1601 sfnode_t *node = VN2SFN(dvp); 1602 uint64_t npages = btopr(len); 1603 1604 ASSERT(node->sf_mapcnt >= npages); 1605 ASMAtomicSubU64(&node->sf_mapcnt, npages); 1606 return (0); 1607 } 1608 #endif 1609 1610 1455 1611 /*ARGSUSED*/ 1456 1612 static int … … 1759 1915 VOPNAME_SPACE, sffs_space, 1760 1916 VOPNAME_WRITE, sffs_write, 1917 1918 # if 0 1919 VOPNAME_MAP, sffs_map, 1920 VOPNAME_ADDMAP, sffs_addmap, 1921 VOPNAME_DELMAP, sffs_delmap, 1922 VOPNAME_GETPAGE, sffs_getpage, 1923 VOPNAME_PUTPAGE, sffs_putpage, 1924 # endif 1925 1761 1926 NULL, NULL 1762 1927 #else … … 1781 1946 VOPNAME_SPACE, { .vop_space = sffs_space }, 1782 1947 VOPNAME_WRITE, { .vop_write = sffs_write }, 1948 1949 #if 0 1950 VOPNAME_MAP, { .vop_map = sffs_map }, 1951 VOPNAME_ADDMAP, { .vop_addmap = sffs_addmap }, 1952 VOPNAME_DELMAP, { .vop_delmap = sffs_delmap }, 1953 VOPNAME_GETPAGE, { .vop_getpage = sffs_getpage }, 1954 VOPNAME_PUTPAGE, { .vop_putpage = sffs_putpage }, 1955 # endif 1956 1783 1957 NULL, NULL 1784 1958 #endif … … 1874 2048 } 1875 2049 2050 #if 0 2051 /* Debug helper functions */ 1876 2052 static void 1877 2053 sfnode_print(sfnode_t *node) … … 1892 2068 } 1893 2069 1894 void1895 sfnode_list( )2070 static void 2071 sfnode_list(void) 1896 2072 { 1897 2073 sfnode_t *n; … … 1902 2078 sfnode_print(n); 1903 2079 } 1904 2080 #endif 2081 -
trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.h
r31691 r37806 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 0 64 volatile uint64_t sf_mapcnt; /* number of mapped pages */ 65 #endif 63 66 } sfnode_t; 64 67
Note:
See TracChangeset
for help on using the changeset viewer.