Print this page
segop_getpolicy already checks for a NULL op


  71 /*
  72  * Private seg op routines.
  73  */
  74 static void     segmap_free(struct seg *seg);
  75 faultcode_t segmap_fault(struct hat *hat, struct seg *seg, caddr_t addr,
  76                         size_t len, enum fault_type type, enum seg_rw rw);
  77 static faultcode_t segmap_faulta(struct seg *seg, caddr_t addr);
  78 static int      segmap_checkprot(struct seg *seg, caddr_t addr, size_t len,
  79                         uint_t prot);
  80 static int      segmap_kluster(struct seg *seg, caddr_t addr, ssize_t);
  81 static int      segmap_getprot(struct seg *seg, caddr_t addr, size_t len,
  82                         uint_t *protv);
  83 static u_offset_t       segmap_getoffset(struct seg *seg, caddr_t addr);
  84 static int      segmap_gettype(struct seg *seg, caddr_t addr);
  85 static int      segmap_getvp(struct seg *seg, caddr_t addr, struct vnode **vpp);
  86 static void     segmap_dump(struct seg *seg);
  87 static int      segmap_pagelock(struct seg *seg, caddr_t addr, size_t len,
  88                         struct page ***ppp, enum lock_type type,
  89                         enum seg_rw rw);
  90 static int      segmap_getmemid(struct seg *seg, caddr_t addr, memid_t *memidp);
  91 static lgrp_mem_policy_info_t   *segmap_getpolicy(struct seg *seg,
  92     caddr_t addr);
  93 static int      segmap_capable(struct seg *seg, segcapability_t capability);
  94 
  95 /* segkpm support */
  96 static caddr_t  segmap_pagecreate_kpm(struct seg *, vnode_t *, u_offset_t,
  97                         struct smap *, enum seg_rw);
  98 struct smap     *get_smap_kpm(caddr_t, page_t **);
  99 
 100 static struct seg_ops segmap_ops = {
 101         .free           = segmap_free,
 102         .fault          = segmap_fault,
 103         .faulta         = segmap_faulta,
 104         .checkprot      = segmap_checkprot,
 105         .kluster        = segmap_kluster,
 106         .getprot        = segmap_getprot,
 107         .getoffset      = segmap_getoffset,
 108         .gettype        = segmap_gettype,
 109         .getvp          = segmap_getvp,
 110         .dump           = segmap_dump,
 111         .pagelock       = segmap_pagelock,
 112         .getmemid       = segmap_getmemid,
 113         .getpolicy      = segmap_getpolicy,
 114         .capable        = segmap_capable,
 115 };
 116 
 117 /*
 118  * Private segmap routines.
 119  */
 120 static void     segmap_unlock(struct hat *hat, struct seg *seg, caddr_t addr,
 121                         size_t len, enum seg_rw rw, struct smap *smp);
 122 static void     segmap_smapadd(struct smap *smp);
 123 static struct smap *segmap_hashin(struct smap *smp, struct vnode *vp,
 124                         u_offset_t off, int hashid);
 125 static void     segmap_hashout(struct smap *smp);
 126 
 127 
 128 /*
 129  * Statistics for segmap operations.
 130  *
 131  * No explicit locking to protect these stats.
 132  */
 133 struct segmapcnt segmapcnt = {


2152                 addr += MAXBSIZE;
2153         }
2154 }
2155 
2156 /*ARGSUSED*/
2157 static int
2158 segmap_pagelock(struct seg *seg, caddr_t addr, size_t len,
2159     struct page ***ppp, enum lock_type type, enum seg_rw rw)
2160 {
2161         return (ENOTSUP);
2162 }
2163 
2164 static int
2165 segmap_getmemid(struct seg *seg, caddr_t addr, memid_t *memidp)
2166 {
2167         struct segmap_data *smd = (struct segmap_data *)seg->s_data;
2168 
2169         memidp->val[0] = (uintptr_t)smd->smd_sm->sm_vp;
2170         memidp->val[1] = smd->smd_sm->sm_off + (uintptr_t)(addr - seg->s_base);
2171         return (0);
2172 }
2173 
2174 /*ARGSUSED*/
2175 static lgrp_mem_policy_info_t *
2176 segmap_getpolicy(struct seg *seg, caddr_t addr)
2177 {
2178         return (NULL);
2179 }
2180 
2181 /*ARGSUSED*/
2182 static int
2183 segmap_capable(struct seg *seg, segcapability_t capability)
2184 {
2185         return (0);
2186 }
2187 
2188 
2189 #ifdef  SEGKPM_SUPPORT
2190 
2191 /*
2192  * segkpm support routines
2193  */
2194 
2195 static caddr_t
2196 segmap_pagecreate_kpm(struct seg *seg, vnode_t *vp, u_offset_t off,
2197         struct smap *smp, enum seg_rw rw)
2198 {




  71 /*
  72  * Private seg op routines.
  73  */
  74 static void     segmap_free(struct seg *seg);
  75 faultcode_t segmap_fault(struct hat *hat, struct seg *seg, caddr_t addr,
  76                         size_t len, enum fault_type type, enum seg_rw rw);
  77 static faultcode_t segmap_faulta(struct seg *seg, caddr_t addr);
  78 static int      segmap_checkprot(struct seg *seg, caddr_t addr, size_t len,
  79                         uint_t prot);
  80 static int      segmap_kluster(struct seg *seg, caddr_t addr, ssize_t);
  81 static int      segmap_getprot(struct seg *seg, caddr_t addr, size_t len,
  82                         uint_t *protv);
  83 static u_offset_t       segmap_getoffset(struct seg *seg, caddr_t addr);
  84 static int      segmap_gettype(struct seg *seg, caddr_t addr);
  85 static int      segmap_getvp(struct seg *seg, caddr_t addr, struct vnode **vpp);
  86 static void     segmap_dump(struct seg *seg);
  87 static int      segmap_pagelock(struct seg *seg, caddr_t addr, size_t len,
  88                         struct page ***ppp, enum lock_type type,
  89                         enum seg_rw rw);
  90 static int      segmap_getmemid(struct seg *seg, caddr_t addr, memid_t *memidp);


  91 static int      segmap_capable(struct seg *seg, segcapability_t capability);
  92 
  93 /* segkpm support */
  94 static caddr_t  segmap_pagecreate_kpm(struct seg *, vnode_t *, u_offset_t,
  95                         struct smap *, enum seg_rw);
  96 struct smap     *get_smap_kpm(caddr_t, page_t **);
  97 
  98 static struct seg_ops segmap_ops = {
  99         .free           = segmap_free,
 100         .fault          = segmap_fault,
 101         .faulta         = segmap_faulta,
 102         .checkprot      = segmap_checkprot,
 103         .kluster        = segmap_kluster,
 104         .getprot        = segmap_getprot,
 105         .getoffset      = segmap_getoffset,
 106         .gettype        = segmap_gettype,
 107         .getvp          = segmap_getvp,
 108         .dump           = segmap_dump,
 109         .pagelock       = segmap_pagelock,
 110         .getmemid       = segmap_getmemid,

 111         .capable        = segmap_capable,
 112 };
 113 
 114 /*
 115  * Private segmap routines.
 116  */
 117 static void     segmap_unlock(struct hat *hat, struct seg *seg, caddr_t addr,
 118                         size_t len, enum seg_rw rw, struct smap *smp);
 119 static void     segmap_smapadd(struct smap *smp);
 120 static struct smap *segmap_hashin(struct smap *smp, struct vnode *vp,
 121                         u_offset_t off, int hashid);
 122 static void     segmap_hashout(struct smap *smp);
 123 
 124 
 125 /*
 126  * Statistics for segmap operations.
 127  *
 128  * No explicit locking to protect these stats.
 129  */
 130 struct segmapcnt segmapcnt = {


2149                 addr += MAXBSIZE;
2150         }
2151 }
2152 
2153 /*ARGSUSED*/
2154 static int
2155 segmap_pagelock(struct seg *seg, caddr_t addr, size_t len,
2156     struct page ***ppp, enum lock_type type, enum seg_rw rw)
2157 {
2158         return (ENOTSUP);
2159 }
2160 
2161 static int
2162 segmap_getmemid(struct seg *seg, caddr_t addr, memid_t *memidp)
2163 {
2164         struct segmap_data *smd = (struct segmap_data *)seg->s_data;
2165 
2166         memidp->val[0] = (uintptr_t)smd->smd_sm->sm_vp;
2167         memidp->val[1] = smd->smd_sm->sm_off + (uintptr_t)(addr - seg->s_base);
2168         return (0);







2169 }
2170 
2171 /*ARGSUSED*/
2172 static int
2173 segmap_capable(struct seg *seg, segcapability_t capability)
2174 {
2175         return (0);
2176 }
2177 
2178 
2179 #ifdef  SEGKPM_SUPPORT
2180 
2181 /*
2182  * segkpm support routines
2183  */
2184 
2185 static caddr_t
2186 segmap_pagecreate_kpm(struct seg *seg, vnode_t *vp, u_offset_t off,
2187         struct smap *smp, enum seg_rw rw)
2188 {