1632 */
1633 return (as_addseg(as, seg));
1634 }
1635
1636 /*
1637 * Unmap a segment and free it from its associated address space.
1638 * This should be called by anybody who's finished with a whole segment's
1639 * mapping. Just calls SEGOP_UNMAP() on the whole mapping . It is the
1640 * responsibility of the segment driver to unlink the the segment
1641 * from the address space, and to free public and private data structures
1642 * associated with the segment. (This is typically done by a call to
1643 * seg_free()).
1644 */
1645 void
1646 seg_unmap(struct seg *seg)
1647 {
1648 #ifdef DEBUG
1649 int ret;
1650 #endif /* DEBUG */
1651
1652 ASSERT(seg->s_as && AS_WRITE_HELD(seg->s_as, &seg->s_as->a_lock));
1653
1654 /* Shouldn't have called seg_unmap if mapping isn't yet established */
1655 ASSERT(seg->s_data != NULL);
1656
1657 /* Unmap the whole mapping */
1658 #ifdef DEBUG
1659 ret = SEGOP_UNMAP(seg, seg->s_base, seg->s_size);
1660 ASSERT(ret == 0);
1661 #else
1662 SEGOP_UNMAP(seg, seg->s_base, seg->s_size);
1663 #endif /* DEBUG */
1664 }
1665
1666 /*
1667 * Free the segment from its associated as. This should only be called
1668 * if a mapping to the segment has not yet been established (e.g., if
1669 * an error occurs in the middle of doing an as_map when the segment
1670 * has already been partially set up) or if it has already been deleted
1671 * (e.g., from a segment driver unmap routine if the unmap applies to the
1672 * entire segment). If the mapping is currently set up then seg_unmap() should
|
1632 */
1633 return (as_addseg(as, seg));
1634 }
1635
1636 /*
1637 * Unmap a segment and free it from its associated address space.
1638 * This should be called by anybody who's finished with a whole segment's
1639 * mapping. Just calls SEGOP_UNMAP() on the whole mapping . It is the
1640 * responsibility of the segment driver to unlink the the segment
1641 * from the address space, and to free public and private data structures
1642 * associated with the segment. (This is typically done by a call to
1643 * seg_free()).
1644 */
1645 void
1646 seg_unmap(struct seg *seg)
1647 {
1648 #ifdef DEBUG
1649 int ret;
1650 #endif /* DEBUG */
1651
1652 ASSERT(seg->s_as && AS_WRITE_HELD(seg->s_as));
1653
1654 /* Shouldn't have called seg_unmap if mapping isn't yet established */
1655 ASSERT(seg->s_data != NULL);
1656
1657 /* Unmap the whole mapping */
1658 #ifdef DEBUG
1659 ret = SEGOP_UNMAP(seg, seg->s_base, seg->s_size);
1660 ASSERT(ret == 0);
1661 #else
1662 SEGOP_UNMAP(seg, seg->s_base, seg->s_size);
1663 #endif /* DEBUG */
1664 }
1665
1666 /*
1667 * Free the segment from its associated as. This should only be called
1668 * if a mapping to the segment has not yet been established (e.g., if
1669 * an error occurs in the middle of doing an as_map when the segment
1670 * has already been partially set up) or if it has already been deleted
1671 * (e.g., from a segment driver unmap routine if the unmap applies to the
1672 * entire segment). If the mapping is currently set up then seg_unmap() should
|