Print this page
6154 const-ify segment ops structures


  89  * routine which is responsible for processing reference and modify bits.
  90  *
  91  * Each segment is protected by it's containing address space lock.  To
  92  * access any field in the segment structure, the "as" must be locked.
  93  * If a segment field is to be modified, the address space lock must be
  94  * write locked.
  95  */
  96 
  97 typedef struct pcache_link {
  98         struct pcache_link      *p_lnext;
  99         struct pcache_link      *p_lprev;
 100 } pcache_link_t;
 101 
 102 typedef struct seg {
 103         caddr_t s_base;                 /* base virtual address */
 104         size_t  s_size;                 /* size in bytes */
 105         uint_t  s_szc;                  /* max page size code */
 106         uint_t  s_flags;                /* flags for segment, see below */
 107         struct  as *s_as;               /* containing address space */
 108         avl_node_t s_tree;              /* AVL tree links to segs in this as */
 109         struct  seg_ops *s_ops;         /* ops vector: see below */
 110         void *s_data;                   /* private data for instance */
 111         kmutex_t s_pmtx;                /* protects seg's pcache list */
 112         pcache_link_t s_phead;          /* head of seg's pcache list */
 113 } seg_t;
 114 
 115 #define S_PURGE         (0x01)          /* seg should be purged in as_gap() */
 116 
 117 struct  seg_ops {
 118         int     (*dup)(struct seg *, struct seg *);
 119         int     (*unmap)(struct seg *, caddr_t, size_t);
 120         void    (*free)(struct seg *);
 121         faultcode_t (*fault)(struct hat *, struct seg *, caddr_t, size_t,
 122             enum fault_type, enum seg_rw);
 123         faultcode_t (*faulta)(struct seg *, caddr_t);
 124         int     (*setprot)(struct seg *, caddr_t, size_t, uint_t);
 125         int     (*checkprot)(struct seg *, caddr_t, size_t, uint_t);
 126         int     (*kluster)(struct seg *, caddr_t, ssize_t);
 127         size_t  (*swapout)(struct seg *);
 128         int     (*sync)(struct seg *, caddr_t, size_t, int, uint_t);
 129         size_t  (*incore)(struct seg *, caddr_t, size_t, char *);




  89  * routine which is responsible for processing reference and modify bits.
  90  *
  91  * Each segment is protected by it's containing address space lock.  To
  92  * access any field in the segment structure, the "as" must be locked.
  93  * If a segment field is to be modified, the address space lock must be
  94  * write locked.
  95  */
  96 
  97 typedef struct pcache_link {
  98         struct pcache_link      *p_lnext;
  99         struct pcache_link      *p_lprev;
 100 } pcache_link_t;
 101 
 102 typedef struct seg {
 103         caddr_t s_base;                 /* base virtual address */
 104         size_t  s_size;                 /* size in bytes */
 105         uint_t  s_szc;                  /* max page size code */
 106         uint_t  s_flags;                /* flags for segment, see below */
 107         struct  as *s_as;               /* containing address space */
 108         avl_node_t s_tree;              /* AVL tree links to segs in this as */
 109         const struct seg_ops *s_ops;    /* ops vector: see below */
 110         void *s_data;                   /* private data for instance */
 111         kmutex_t s_pmtx;                /* protects seg's pcache list */
 112         pcache_link_t s_phead;          /* head of seg's pcache list */
 113 } seg_t;
 114 
 115 #define S_PURGE         (0x01)          /* seg should be purged in as_gap() */
 116 
 117 struct  seg_ops {
 118         int     (*dup)(struct seg *, struct seg *);
 119         int     (*unmap)(struct seg *, caddr_t, size_t);
 120         void    (*free)(struct seg *);
 121         faultcode_t (*fault)(struct hat *, struct seg *, caddr_t, size_t,
 122             enum fault_type, enum seg_rw);
 123         faultcode_t (*faulta)(struct seg *, caddr_t);
 124         int     (*setprot)(struct seg *, caddr_t, size_t, uint_t);
 125         int     (*checkprot)(struct seg *, caddr_t, size_t, uint_t);
 126         int     (*kluster)(struct seg *, caddr_t, ssize_t);
 127         size_t  (*swapout)(struct seg *);
 128         int     (*sync)(struct seg *, caddr_t, size_t, int, uint_t);
 129         size_t  (*incore)(struct seg *, caddr_t, size_t, char *);