Print this page
6154 const-ify segment ops structures

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/sunddi.c
          +++ new/usr/src/uts/common/os/sunddi.c
↓ open down ↓ 8360 lines elided ↑ open up ↑
8361 8361           * after the locking is done.
8362 8362           * Doing this after as_pagelock guarantees persistence of the as; if
8363 8363           * an unacceptable segment is found, the cleanup includes calling
8364 8364           * as_pageunlock before returning EFAULT.
8365 8365           *
8366 8366           * segdev is allowed here as it is already locked.  This allows
8367 8367           * for memory exported by drivers through mmap() (which is already
8368 8368           * locked) to be allowed for LONGTERM.
8369 8369           */
8370 8370          if (flags & DDI_UMEMLOCK_LONGTERM) {
8371      -                extern  struct seg_ops segspt_shmops;
8372      -                extern  struct seg_ops segdev_ops;
     8371 +                extern const struct seg_ops segspt_shmops;
     8372 +                extern const struct seg_ops segdev_ops;
8373 8373                  AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
8374 8374                  for (seg = as_segat(as, addr); ; seg = AS_SEGNEXT(as, seg)) {
8375 8375                          if (seg == NULL || seg->s_base > addr + len)
8376 8376                                  break;
8377 8377                          if (seg->s_ops == &segdev_ops)
8378 8378                                  continue;
8379 8379                          if (((seg->s_ops != &segvn_ops) &&
8380 8380                              (seg->s_ops != &segspt_shmops)) ||
8381 8381                              ((segop_getvp(seg, addr, &vp) == 0 &&
8382 8382                              vp != NULL && vp->v_type == VREG) &&
↓ open down ↓ 1642 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX