Print this page
6154 const-ify segment ops structures

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/vm/vm_as.c
          +++ new/usr/src/uts/common/vm/vm_as.c
↓ open down ↓ 466 lines elided ↑ open up ↑
 467  467  
 468  468                  /*
 469  469                   * If top of seg is below the requested address, then
 470  470                   * the insertion point is at the end of the linked list,
 471  471                   * and seg points to the tail of the list.  Otherwise,
 472  472                   * the insertion point is immediately before seg.
 473  473                   */
 474  474                  if (base + seg->s_size > addr) {
 475  475                          if (addr >= base || eaddr > base) {
 476  476  #ifdef __sparc
 477      -                                extern struct seg_ops segnf_ops;
      477 +                                extern const struct seg_ops segnf_ops;
 478  478  
 479  479                                  /*
 480  480                                   * no-fault segs must disappear if overlaid.
 481  481                                   * XXX need new segment type so
 482  482                                   * we don't have to check s_ops
 483  483                                   */
 484  484                                  if (seg->s_ops == &segnf_ops) {
 485  485                                          seg_unmap(seg);
 486  486                                          goto again;
 487  487                                  }
↓ open down ↓ 387 lines elided ↑ open up ↑
 875  875          caddr_t raddr;                  /* rounded down addr */
 876  876          size_t rsize;                   /* rounded up size */
 877  877          size_t ssize;
 878  878          faultcode_t res = 0;
 879  879          caddr_t addrsav;
 880  880          struct seg *segsav;
 881  881          int as_lock_held;
 882  882          klwp_t *lwp = ttolwp(curthread);
 883  883          int is_xhat = 0;
 884  884          int holding_wpage = 0;
 885      -        extern struct seg_ops   segdev_ops;
 886      -
 887      -
 888  885  
 889  886          if (as->a_hat != hat) {
 890  887                  /* This must be an XHAT then */
 891  888                  is_xhat = 1;
 892  889  
 893  890                  if ((type != F_INVAL) || (as == &kas))
 894  891                          return (FC_NOSUPPORT);
 895  892          }
 896  893  
 897  894  retry:
↓ open down ↓ 1183 lines elided ↑ open up ↑
2081 2078  }
2082 2079  
2083 2080  /*
2084 2081   * Return the next range within [base, base + len) that is backed
2085 2082   * with "real memory".  Skip holes and non-seg_vn segments.
2086 2083   * We're lazy and only return one segment at a time.
2087 2084   */
2088 2085  int
2089 2086  as_memory(struct as *as, caddr_t *basep, size_t *lenp)
2090 2087  {
2091      -        extern struct seg_ops segspt_shmops;    /* needs a header file */
     2088 +        extern const struct seg_ops segspt_shmops; /* needs a header file */
2092 2089          struct seg *seg;
2093 2090          caddr_t addr, eaddr;
2094 2091          caddr_t segend;
2095 2092  
2096 2093          AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
2097 2094  
2098 2095          addr = *basep;
2099 2096          eaddr = addr + *lenp;
2100 2097  
2101 2098          seg = as_findseg(as, addr, 0);
↓ open down ↓ 83 lines elided ↑ open up ↑
2185 2182          mutex_enter(&as->a_contents);
2186 2183          AS_CLRBUSY(as);
2187 2184          mutex_exit(&as->a_contents);
2188 2185  
2189 2186          /*
2190 2187           * Call the swapout routines of all segments in the address
2191 2188           * space to do the actual work, accumulating the amount of
2192 2189           * space reclaimed.
2193 2190           */
2194 2191          for (seg = AS_SEGFIRST(as); seg != NULL; seg = AS_SEGNEXT(as, seg)) {
2195      -                struct seg_ops *ov = seg->s_ops;
     2192 +                const struct seg_ops *ov = seg->s_ops;
2196 2193  
2197 2194                  /*
2198 2195                   * We have to check to see if the seg has
2199 2196                   * an ops vector because the seg may have
2200 2197                   * been in the middle of being set up when
2201 2198                   * the process was picked for swapout.
2202 2199                   */
2203 2200                  if ((ov != NULL) && (ov->swapout != NULL))
2204 2201                          swpcnt += segop_swapout(seg);
2205 2202          }
↓ open down ↓ 419 lines elided ↑ open up ↑
2625 2622          ulong_t segcnt = 1;
2626 2623          ulong_t cnt;
2627 2624          size_t ssize;
2628 2625          pgcnt_t npages = btop(size);
2629 2626          page_t **plist;
2630 2627          page_t **pl;
2631 2628          int error;
2632 2629          caddr_t eaddr;
2633 2630          faultcode_t fault_err = 0;
2634 2631          pgcnt_t pl_off;
2635      -        extern struct seg_ops segspt_shmops;
     2632 +        extern const struct seg_ops segspt_shmops;
2636 2633  
2637 2634          ASSERT(AS_LOCK_HELD(as, &as->a_lock));
2638 2635          ASSERT(seg != NULL);
2639 2636          ASSERT(addr >= seg->s_base && addr < seg->s_base + seg->s_size);
2640 2637          ASSERT(addr + size > seg->s_base + seg->s_size);
2641 2638          ASSERT(IS_P2ALIGNED(size, PAGESIZE));
2642 2639          ASSERT(IS_P2ALIGNED(addr, PAGESIZE));
2643 2640  
2644 2641          /*
2645 2642           * Count the number of segments covered by the range we are about to
↓ open down ↓ 1035 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX