Print this page
no need for bad-op segment op functions
The segment drivers have a number of bad-op functions that simply panic.
Keeping the function pointer NULL will accomplish the same thing in most
cases.  In other cases, keeping the function pointer NULL will result in
proper error code being returned.

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/vm/seg_spt.c
          +++ new/usr/src/uts/common/vm/seg_spt.c
↓ open down ↓ 68 lines elided ↑ open up ↑
  69   69   * the system) they can patch the segspt_minfree to smaller number.
  70   70   */
  71   71  pgcnt_t segspt_minfree = 0;
  72   72  
  73   73  static int segspt_create(struct seg *seg, caddr_t argsp);
  74   74  static int segspt_unmap(struct seg *seg, caddr_t raddr, size_t ssize);
  75   75  static void segspt_free(struct seg *seg);
  76   76  static void segspt_free_pages(struct seg *seg, caddr_t addr, size_t len);
  77   77  static lgrp_mem_policy_info_t *segspt_getpolicy(struct seg *seg, caddr_t addr);
  78   78  
  79      -static void
  80      -segspt_badop()
  81      -{
  82      -        panic("segspt_badop called");
  83      -        /*NOTREACHED*/
  84      -}
  85      -
  86      -#define SEGSPT_BADOP(t) (t(*)())segspt_badop
  87      -
  88   79  struct seg_ops segspt_ops = {
  89      -        .dup            = SEGSPT_BADOP(int),
  90   80          .unmap          = segspt_unmap,
  91   81          .free           = segspt_free,
  92      -        .fault          = SEGSPT_BADOP(int),
  93      -        .faulta         = SEGSPT_BADOP(faultcode_t),
  94      -        .setprot        = SEGSPT_BADOP(int),
  95      -        .checkprot      = SEGSPT_BADOP(int),
  96      -        .kluster        = SEGSPT_BADOP(int),
  97      -        .sync           = SEGSPT_BADOP(int),
  98      -        .incore         = SEGSPT_BADOP(size_t),
  99      -        .lockop         = SEGSPT_BADOP(int),
 100      -        .getprot        = SEGSPT_BADOP(int),
 101      -        .getoffset      = SEGSPT_BADOP(u_offset_t),
 102      -        .gettype        = SEGSPT_BADOP(int),
 103      -        .getvp          = SEGSPT_BADOP(int),
 104      -        .advise         = SEGSPT_BADOP(int),
 105      -        .dump           = SEGSPT_BADOP(void),
 106      -        .pagelock       = SEGSPT_BADOP(int),
 107      -        .setpagesize    = SEGSPT_BADOP(int),
 108      -        .getmemid       = SEGSPT_BADOP(int),
 109   82          .getpolicy      = segspt_getpolicy,
 110      -        .capable        = SEGSPT_BADOP(int),
 111   83          .inherit        = seg_inherit_notsup,
 112   84  };
 113   85  
 114   86  static int segspt_shmdup(struct seg *seg, struct seg *newseg);
 115   87  static int segspt_shmunmap(struct seg *seg, caddr_t raddr, size_t ssize);
 116   88  static void segspt_shmfree(struct seg *seg);
 117   89  static faultcode_t segspt_shmfault(struct hat *hat, struct seg *seg,
 118   90                  caddr_t addr, size_t len, enum fault_type type, enum seg_rw rw);
 119   91  static faultcode_t segspt_shmfaulta(struct seg *seg, caddr_t addr);
 120   92  static int segspt_shmsetprot(register struct seg *seg, register caddr_t addr,
↓ open down ↓ 2966 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX