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.


  59 
  60 /*
  61  * segspt_minfree is the memory left for system after ISM
  62  * locked its pages; it is set up to 5% of availrmem in
  63  * sptcreate when ISM is created.  ISM should not use more
  64  * than ~90% of availrmem; if it does, then the performance
  65  * of the system may decrease. Machines with large memories may
  66  * be able to use up more memory for ISM so we set the default
  67  * segspt_minfree to 5% (which gives ISM max 95% of availrmem.
  68  * If somebody wants even more memory for ISM (risking hanging
  69  * the system) they can patch the segspt_minfree to smaller number.
  70  */
  71 pgcnt_t segspt_minfree = 0;
  72 
  73 static int segspt_create(struct seg *seg, caddr_t argsp);
  74 static int segspt_unmap(struct seg *seg, caddr_t raddr, size_t ssize);
  75 static void segspt_free(struct seg *seg);
  76 static void segspt_free_pages(struct seg *seg, caddr_t addr, size_t len);
  77 static lgrp_mem_policy_info_t *segspt_getpolicy(struct seg *seg, caddr_t addr);
  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 struct seg_ops segspt_ops = {
  89         .dup            = SEGSPT_BADOP(int),
  90         .unmap          = segspt_unmap,
  91         .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         .getpolicy      = segspt_getpolicy,
 110         .capable        = SEGSPT_BADOP(int),
 111         .inherit        = seg_inherit_notsup,
 112 };
 113 
 114 static int segspt_shmdup(struct seg *seg, struct seg *newseg);
 115 static int segspt_shmunmap(struct seg *seg, caddr_t raddr, size_t ssize);
 116 static void segspt_shmfree(struct seg *seg);
 117 static faultcode_t segspt_shmfault(struct hat *hat, struct seg *seg,
 118                 caddr_t addr, size_t len, enum fault_type type, enum seg_rw rw);
 119 static faultcode_t segspt_shmfaulta(struct seg *seg, caddr_t addr);
 120 static int segspt_shmsetprot(register struct seg *seg, register caddr_t addr,
 121                         register size_t len, register uint_t prot);
 122 static int segspt_shmcheckprot(struct seg *seg, caddr_t addr, size_t size,
 123                         uint_t prot);
 124 static int      segspt_shmkluster(struct seg *seg, caddr_t addr, ssize_t delta);
 125 static size_t segspt_shmincore(struct seg *seg, caddr_t addr, size_t len,
 126                         register char *vec);
 127 static int segspt_shmsync(struct seg *seg, register caddr_t addr, size_t len,
 128                         int attr, uint_t flags);
 129 static int segspt_shmlockop(struct seg *seg, caddr_t addr, size_t len,
 130                         int attr, int op, ulong_t *lockmap, size_t pos);




  59 
  60 /*
  61  * segspt_minfree is the memory left for system after ISM
  62  * locked its pages; it is set up to 5% of availrmem in
  63  * sptcreate when ISM is created.  ISM should not use more
  64  * than ~90% of availrmem; if it does, then the performance
  65  * of the system may decrease. Machines with large memories may
  66  * be able to use up more memory for ISM so we set the default
  67  * segspt_minfree to 5% (which gives ISM max 95% of availrmem.
  68  * If somebody wants even more memory for ISM (risking hanging
  69  * the system) they can patch the segspt_minfree to smaller number.
  70  */
  71 pgcnt_t segspt_minfree = 0;
  72 
  73 static int segspt_create(struct seg *seg, caddr_t argsp);
  74 static int segspt_unmap(struct seg *seg, caddr_t raddr, size_t ssize);
  75 static void segspt_free(struct seg *seg);
  76 static void segspt_free_pages(struct seg *seg, caddr_t addr, size_t len);
  77 static lgrp_mem_policy_info_t *segspt_getpolicy(struct seg *seg, caddr_t addr);
  78 









  79 struct seg_ops segspt_ops = {

  80         .unmap          = segspt_unmap,
  81         .free           = segspt_free,

















  82         .getpolicy      = segspt_getpolicy,

  83         .inherit        = seg_inherit_notsup,
  84 };
  85 
  86 static int segspt_shmdup(struct seg *seg, struct seg *newseg);
  87 static int segspt_shmunmap(struct seg *seg, caddr_t raddr, size_t ssize);
  88 static void segspt_shmfree(struct seg *seg);
  89 static faultcode_t segspt_shmfault(struct hat *hat, struct seg *seg,
  90                 caddr_t addr, size_t len, enum fault_type type, enum seg_rw rw);
  91 static faultcode_t segspt_shmfaulta(struct seg *seg, caddr_t addr);
  92 static int segspt_shmsetprot(register struct seg *seg, register caddr_t addr,
  93                         register size_t len, register uint_t prot);
  94 static int segspt_shmcheckprot(struct seg *seg, caddr_t addr, size_t size,
  95                         uint_t prot);
  96 static int      segspt_shmkluster(struct seg *seg, caddr_t addr, ssize_t delta);
  97 static size_t segspt_shmincore(struct seg *seg, caddr_t addr, size_t len,
  98                         register char *vec);
  99 static int segspt_shmsync(struct seg *seg, register caddr_t addr, size_t len,
 100                         int attr, uint_t flags);
 101 static int segspt_shmlockop(struct seg *seg, caddr_t addr, size_t len,
 102                         int attr, int op, ulong_t *lockmap, size_t pos);