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.

@@ -73,11 +73,10 @@
 #include <sys/bitmap.h>
 
 /*
  * Private seg op routines
  */
-static void     segkp_badop(void);
 static void     segkp_dump(struct seg *seg);
 static int      segkp_checkprot(struct seg *seg, caddr_t addr, size_t len,
                         uint_t prot);
 static int      segkp_kluster(struct seg *seg, caddr_t addr, ssize_t delta);
 static int      segkp_pagelock(struct seg *seg, caddr_t addr, size_t len,

@@ -107,12 +106,10 @@
 /*
  * The segkp caches
  */
 static struct segkp_cache segkp_cache[SEGKP_MAX_CACHE];
 
-#define SEGKP_BADOP(t)  (t(*)())segkp_badop
-
 /*
  * When there are fewer than red_minavail bytes left on the stack,
  * segkp_map_red() will map in the redzone (if called).  5000 seems
  * to work reasonably well...
  */

@@ -144,43 +141,22 @@
 
 pgcnt_t anon_segkp_pages_locked;        /* See vm/anon.h */
 pgcnt_t anon_segkp_pages_resv;          /* anon reserved by seg_kp */
 
 static struct   seg_ops segkp_ops = {
-        .dup            = SEGKP_BADOP(int),
-        .unmap          = SEGKP_BADOP(int),
-        .free           = SEGKP_BADOP(void),
         .fault          = segkp_fault,
-        .faulta         = SEGKP_BADOP(faultcode_t),
-        .setprot        = SEGKP_BADOP(int),
         .checkprot      = segkp_checkprot,
         .kluster        = segkp_kluster,
-        .sync           = SEGKP_BADOP(int),
-        .incore         = SEGKP_BADOP(size_t),
-        .lockop         = SEGKP_BADOP(int),
-        .getprot        = SEGKP_BADOP(int),
-        .getoffset      = SEGKP_BADOP(u_offset_t),
-        .gettype        = SEGKP_BADOP(int),
-        .getvp          = SEGKP_BADOP(int),
-        .advise         = SEGKP_BADOP(int),
         .dump           = segkp_dump,
         .pagelock       = segkp_pagelock,
-        .setpagesize    = SEGKP_BADOP(int),
         .getmemid       = segkp_getmemid,
         .getpolicy      = segkp_getpolicy,
         .capable        = segkp_capable,
         .inherit        = seg_inherit_notsup,
 };
 
 
-static void
-segkp_badop(void)
-{
-        panic("segkp_badop");
-        /*NOTREACHED*/
-}
-
 static void segkpinit_mem_config(struct seg *);
 
 static uint32_t segkp_indel;
 
 /*