Print this page
patch lower-case-segops

*** 24,35 **** */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ - #pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/atomic.h> #include <sys/errno.h> #include <sys/stat.h> #include <sys/modctl.h> #include <sys/conf.h> --- 24,33 ----
*** 70,84 **** * Fail if the page doesn't map to a page in the underlying * mapped file, if an underlying mapped file exists. */ vattr.va_mask = AT_SIZE; if (seg->s_ops == &segvn_ops && ! SEGOP_GETVP(seg, addr, &vp) == 0 && vp != NULL && vp->v_type == VREG && VOP_GETATTR(vp, &vattr, 0, CRED(), NULL) == 0) { u_offset_t size = roundup(vattr.va_size, (u_offset_t)PAGESIZE); ! u_offset_t offset = SEGOP_GETOFFSET(seg, addr); if (offset >= size) return (0); } --- 68,82 ---- * Fail if the page doesn't map to a page in the underlying * mapped file, if an underlying mapped file exists. */ vattr.va_mask = AT_SIZE; if (seg->s_ops == &segvn_ops && ! segop_getvp(seg, addr, &vp) == 0 && vp != NULL && vp->v_type == VREG && VOP_GETATTR(vp, &vattr, 0, CRED(), NULL) == 0) { u_offset_t size = roundup(vattr.va_size, (u_offset_t)PAGESIZE); ! u_offset_t offset = segop_getoffset(seg, addr); if (offset >= size) return (0); }
*** 94,104 **** * Fail if the segment is mapped from /dev/null. * The key is that the mapping comes from segdev and the * type is neither MAP_SHARED nor MAP_PRIVATE. */ if (seg->s_ops == &segdev_ops && ! ((SEGOP_GETTYPE(seg, addr) & (MAP_SHARED | MAP_PRIVATE)) == 0)) return (0); /* * Fail if the page is a MAP_NORESERVE page that has * not actually materialized. --- 92,102 ---- * Fail if the segment is mapped from /dev/null. * The key is that the mapping comes from segdev and the * type is neither MAP_SHARED nor MAP_PRIVATE. */ if (seg->s_ops == &segdev_ops && ! ((segop_gettype(seg, addr) & (MAP_SHARED | MAP_PRIVATE)) == 0)) return (0); /* * Fail if the page is a MAP_NORESERVE page that has * not actually materialized.
*** 115,125 **** * low-order bit that indicates the page is * actually in memory. If any bits are set, * then there is backing store for the page. */ char incore = 0; ! (void) SEGOP_INCORE(seg, addr, PAGESIZE, &incore); if (incore == 0) return (0); } return (1); } --- 113,123 ---- * low-order bit that indicates the page is * actually in memory. If any bits are set, * then there is backing store for the page. */ char incore = 0; ! (void) segop_incore(seg, addr, PAGESIZE, &incore); if (incore == 0) return (0); } return (1); }
*** 207,222 **** if ((seg = as_segat(as, page)) == NULL || !page_valid(seg, page)) { AS_LOCK_EXIT(as, &as->a_lock); return (ENXIO); } ! SEGOP_GETPROT(seg, page, 0, &prot); protchanged = 0; if ((prot & prot_rw) == 0) { protchanged = 1; ! err = SEGOP_SETPROT(seg, page, PAGESIZE, prot | prot_rw); if (err == IE_RETRY) { protchanged = 0; ASSERT(retrycnt == 0); retrycnt++; --- 205,220 ---- if ((seg = as_segat(as, page)) == NULL || !page_valid(seg, page)) { AS_LOCK_EXIT(as, &as->a_lock); return (ENXIO); } ! (void) segop_getprot(seg, page, 0, &prot); protchanged = 0; if ((prot & prot_rw) == 0) { protchanged = 1; ! err = segop_setprot(seg, page, PAGESIZE, prot | prot_rw); if (err == IE_RETRY) { protchanged = 0; ASSERT(retrycnt == 0); retrycnt++;
*** 242,254 **** else if (seg->s_ops == &segvn_ops) rw = S_READ_NOCOW; else rw = S_READ; ! if (SEGOP_FAULT(as->a_hat, seg, page, PAGESIZE, F_SOFTLOCK, rw)) { if (protchanged) ! (void) SEGOP_SETPROT(seg, page, PAGESIZE, prot); AS_LOCK_EXIT(as, &as->a_lock); return (ENXIO); } CPU_STATS_ADD_K(vm, softlock, 1); --- 240,252 ---- else if (seg->s_ops == &segvn_ops) rw = S_READ_NOCOW; else rw = S_READ; ! if (segop_fault(as->a_hat, seg, page, PAGESIZE, F_SOFTLOCK, rw)) { if (protchanged) ! (void) segop_setprot(seg, page, PAGESIZE, prot); AS_LOCK_EXIT(as, &as->a_lock); return (ENXIO); } CPU_STATS_ADD_K(vm, softlock, 1);
*** 301,314 **** mapout(as, addr, vaddr, writing); if (rw == S_READ_NOCOW) rw = S_READ; ! (void) SEGOP_FAULT(as->a_hat, seg, page, PAGESIZE, F_SOFTUNLOCK, rw); if (protchanged) ! (void) SEGOP_SETPROT(seg, page, PAGESIZE, prot); AS_LOCK_EXIT(as, &as->a_lock); return (error); } --- 299,312 ---- mapout(as, addr, vaddr, writing); if (rw == S_READ_NOCOW) rw = S_READ; ! (void) segop_fault(as->a_hat, seg, page, PAGESIZE, F_SOFTUNLOCK, rw); if (protchanged) ! (void) segop_setprot(seg, page, PAGESIZE, prot); AS_LOCK_EXIT(as, &as->a_lock); return (error); }