Print this page
const-ify make segment ops structures
There is no reason to keep the segment ops structures writable.


 188 #define seg_phashtab_wired              pctrl1.p_htabwired
 189 #define seg_pkmcache                    pctrl1.p_kmcache
 190 #define seg_pmem_mtx                    pctrl2.p_mem_mtx
 191 #define seg_plocked_window              pctrl2.p_locked_win
 192 #define seg_plocked                     pctrl2.p_locked
 193 #define seg_pahcur                      pctrl2.p_ahcur
 194 #define seg_pathr_on                    pctrl2.p_athr_on
 195 #define seg_pahhead                     pctrl2.p_ahhead
 196 #define seg_pmax_pcpage                 pctrl3.p_pcp_maxage
 197 #define seg_pathr_empty_ahb             pctrl3.p_athr_empty_ahb
 198 #define seg_pathr_full_ahb              pctrl3.p_athr_full_ahb
 199 #define seg_pshrink_shift               pctrl3.p_shrink_shft
 200 #define seg_pmaxapurge_npages           pctrl3.p_maxapurge_npages
 201 
 202 #define P_HASHWIN_MASK                  (seg_phashsize_win - 1)
 203 #define P_HASHWIRED_MASK                (seg_phashsize_wired - 1)
 204 #define P_BASESHIFT                     (6)
 205 
 206 kthread_t *seg_pasync_thr;
 207 
 208 extern struct seg_ops segvn_ops;
 209 extern struct seg_ops segspt_shmops;
 210 
 211 #define IS_PFLAGS_WIRED(flags) ((flags) & SEGP_FORCE_WIRED)
 212 #define IS_PCP_WIRED(pcp) IS_PFLAGS_WIRED((pcp)->p_flags)
 213 
 214 #define LBOLT_DELTA(t)  ((ulong_t)(ddi_get_lbolt() - (t)))
 215 
 216 #define PCP_AGE(pcp)    LBOLT_DELTA((pcp)->p_lbolt)
 217 
 218 /*
 219  * htag0 argument can be a seg or amp pointer.
 220  */
 221 #define P_HASHBP(seg, htag0, addr, flags)                               \
 222         (IS_PFLAGS_WIRED((flags)) ?                                     \
 223             ((struct seg_phash *)&seg_phashtab_wired[P_HASHWIRED_MASK & \
 224             ((uintptr_t)(htag0) >> P_BASESHIFT)]) :                       \
 225             (&seg_phashtab_win[P_HASHWIN_MASK &                         \
 226             (((uintptr_t)(htag0) >> 3) ^                          \
 227             ((uintptr_t)(addr) >> ((flags & SEGP_PSHIFT) ?            \
 228             (flags >> 16) : page_get_shift((seg)->s_szc))))]))
 229 




 188 #define seg_phashtab_wired              pctrl1.p_htabwired
 189 #define seg_pkmcache                    pctrl1.p_kmcache
 190 #define seg_pmem_mtx                    pctrl2.p_mem_mtx
 191 #define seg_plocked_window              pctrl2.p_locked_win
 192 #define seg_plocked                     pctrl2.p_locked
 193 #define seg_pahcur                      pctrl2.p_ahcur
 194 #define seg_pathr_on                    pctrl2.p_athr_on
 195 #define seg_pahhead                     pctrl2.p_ahhead
 196 #define seg_pmax_pcpage                 pctrl3.p_pcp_maxage
 197 #define seg_pathr_empty_ahb             pctrl3.p_athr_empty_ahb
 198 #define seg_pathr_full_ahb              pctrl3.p_athr_full_ahb
 199 #define seg_pshrink_shift               pctrl3.p_shrink_shft
 200 #define seg_pmaxapurge_npages           pctrl3.p_maxapurge_npages
 201 
 202 #define P_HASHWIN_MASK                  (seg_phashsize_win - 1)
 203 #define P_HASHWIRED_MASK                (seg_phashsize_wired - 1)
 204 #define P_BASESHIFT                     (6)
 205 
 206 kthread_t *seg_pasync_thr;
 207 
 208 extern const struct seg_ops segvn_ops;
 209 extern const struct seg_ops segspt_shmops;
 210 
 211 #define IS_PFLAGS_WIRED(flags) ((flags) & SEGP_FORCE_WIRED)
 212 #define IS_PCP_WIRED(pcp) IS_PFLAGS_WIRED((pcp)->p_flags)
 213 
 214 #define LBOLT_DELTA(t)  ((ulong_t)(ddi_get_lbolt() - (t)))
 215 
 216 #define PCP_AGE(pcp)    LBOLT_DELTA((pcp)->p_lbolt)
 217 
 218 /*
 219  * htag0 argument can be a seg or amp pointer.
 220  */
 221 #define P_HASHBP(seg, htag0, addr, flags)                               \
 222         (IS_PFLAGS_WIRED((flags)) ?                                     \
 223             ((struct seg_phash *)&seg_phashtab_wired[P_HASHWIRED_MASK & \
 224             ((uintptr_t)(htag0) >> P_BASESHIFT)]) :                       \
 225             (&seg_phashtab_win[P_HASHWIN_MASK &                         \
 226             (((uintptr_t)(htag0) >> 3) ^                          \
 227             ((uintptr_t)(addr) >> ((flags & SEGP_PSHIFT) ?            \
 228             (flags >> 16) : page_get_shift((seg)->s_szc))))]))
 229