Print this page
instead using SEGOP_* macros, define full-fledged segop_* functions
This will allow us to do some sanity checking or even implement stub
functionality in one place instead of duplicating it wherever these wrappers
are used.

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/vm/seg.h
          +++ new/usr/src/uts/common/vm/seg.h
↓ open down ↓ 201 lines elided ↑ open up ↑
 202  202  
 203  203  /* Page status bits for segop_incore */
 204  204  #define SEG_PAGE_INCORE         0x01    /* VA has a page backing it */
 205  205  #define SEG_PAGE_LOCKED         0x02    /* VA has a page that is locked */
 206  206  #define SEG_PAGE_HASCOW         0x04    /* VA has a page with a copy-on-write */
 207  207  #define SEG_PAGE_SOFTLOCK       0x08    /* VA has a page with softlock held */
 208  208  #define SEG_PAGE_VNODEBACKED    0x10    /* Segment is backed by a vnode */
 209  209  #define SEG_PAGE_ANON           0x20    /* VA has an anonymous page */
 210  210  #define SEG_PAGE_VNODE          0x40    /* VA has a vnode page backing it */
 211  211  
 212      -#define SEGOP_DUP(s, n)             (*(s)->s_ops->dup)((s), (n))
 213      -#define SEGOP_UNMAP(s, a, l)        (*(s)->s_ops->unmap)((s), (a), (l))
 214      -#define SEGOP_FREE(s)               (*(s)->s_ops->free)((s))
 215      -#define SEGOP_FAULT(h, s, a, l, t, rw) \
 216      -                (*(s)->s_ops->fault)((h), (s), (a), (l), (t), (rw))
 217      -#define SEGOP_FAULTA(s, a)          (*(s)->s_ops->faulta)((s), (a))
 218      -#define SEGOP_SETPROT(s, a, l, p)   (*(s)->s_ops->setprot)((s), (a), (l), (p))
 219      -#define SEGOP_CHECKPROT(s, a, l, p) (*(s)->s_ops->checkprot)((s), (a), (l), (p))
 220      -#define SEGOP_KLUSTER(s, a, d)      (*(s)->s_ops->kluster)((s), (a), (d))
 221      -#define SEGOP_SYNC(s, a, l, atr, f) \
 222      -                (*(s)->s_ops->sync)((s), (a), (l), (atr), (f))
 223      -#define SEGOP_INCORE(s, a, l, v)    (*(s)->s_ops->incore)((s), (a), (l), (v))
 224      -#define SEGOP_LOCKOP(s, a, l, atr, op, b, p) \
 225      -                (*(s)->s_ops->lockop)((s), (a), (l), (atr), (op), (b), (p))
 226      -#define SEGOP_GETPROT(s, a, l, p)   (*(s)->s_ops->getprot)((s), (a), (l), (p))
 227      -#define SEGOP_GETOFFSET(s, a)       (*(s)->s_ops->getoffset)((s), (a))
 228      -#define SEGOP_GETTYPE(s, a)         (*(s)->s_ops->gettype)((s), (a))
 229      -#define SEGOP_GETVP(s, a, vpp)      (*(s)->s_ops->getvp)((s), (a), (vpp))
 230      -#define SEGOP_ADVISE(s, a, l, b)    (*(s)->s_ops->advise)((s), (a), (l), (b))
 231      -#define SEGOP_DUMP(s)               (*(s)->s_ops->dump)((s))
 232      -#define SEGOP_PAGELOCK(s, a, l, p, t, rw) \
 233      -                (*(s)->s_ops->pagelock)((s), (a), (l), (p), (t), (rw))
 234      -#define SEGOP_SETPAGESIZE(s, a, l, szc) \
 235      -                (*(s)->s_ops->setpagesize)((s), (a), (l), (szc))
 236      -#define SEGOP_GETMEMID(s, a, mp)    (*(s)->s_ops->getmemid)((s), (a), (mp))
 237      -#define SEGOP_GETPOLICY(s, a)       (*(s)->s_ops->getpolicy)((s), (a))
 238      -#define SEGOP_CAPABLE(s, c)         (*(s)->s_ops->capable)((s), (c))
 239      -#define SEGOP_INHERIT(s, a, l, b)   (*(s)->s_ops->inherit)((s), (a), (l), (b))
 240      -
 241  212  #define seg_page(seg, addr) \
 242  213          (((uintptr_t)((addr) - (seg)->s_base)) >> PAGESHIFT)
 243  214  
 244  215  #define seg_pages(seg) \
 245  216          (((uintptr_t)((seg)->s_size + PAGEOFFSET)) >> PAGESHIFT)
 246  217  
 247  218  #define IE_NOMEM        -1      /* internal to seg layer */
 248  219  #define IE_RETRY        -2      /* internal to seg layer */
 249  220  #define IE_REATTACH     -3      /* internal to seg layer */
 250  221  
↓ open down ↓ 17 lines elided ↑ open up ↑
 268  239  
 269  240  #ifdef VMDEBUG
 270  241  
 271  242  uint_t  seg_page(struct seg *, caddr_t);
 272  243  uint_t  seg_pages(struct seg *);
 273  244  
 274  245  #endif  /* VMDEBUG */
 275  246  
 276  247  boolean_t       seg_can_change_zones(struct seg *);
 277  248  size_t          seg_swresv(struct seg *);
      249 +
      250 +/* segop wrappers */
      251 +int segop_dup(struct seg *, struct seg *);
      252 +int segop_unmap(struct seg *, caddr_t, size_t);
      253 +void segop_free(struct seg *);
      254 +faultcode_t segop_fault(struct hat *, struct seg *, caddr_t, size_t, enum fault_type, enum seg_rw);
      255 +faultcode_t segop_faulta(struct seg *, caddr_t);
      256 +int segop_setprot(struct seg *, caddr_t, size_t, uint_t);
      257 +int segop_checkprot(struct seg *, caddr_t, size_t, uint_t);
      258 +int segop_kluster(struct seg *, caddr_t, ssize_t);
      259 +int segop_sync(struct seg *, caddr_t, size_t, int, uint_t);
      260 +size_t segop_incore(struct seg *, caddr_t, size_t, char *);
      261 +int segop_lockop(struct seg *, caddr_t, size_t, int, int, ulong_t *, size_t );
      262 +int segop_getprot(struct seg *, caddr_t, size_t, uint_t *);
      263 +u_offset_t segop_getoffset(struct seg *, caddr_t);
      264 +int segop_gettype(struct seg *, caddr_t);
      265 +int segop_getvp(struct seg *, caddr_t, struct vnode **);
      266 +int segop_advise(struct seg *, caddr_t, size_t, uint_t);
      267 +void segop_dump(struct seg *);
      268 +int segop_pagelock(struct seg *, caddr_t, size_t, struct page ***, enum lock_type, enum seg_rw);
      269 +int segop_setpagesize(struct seg *, caddr_t, size_t, uint_t);
      270 +int segop_getmemid(struct seg *, caddr_t, memid_t *);
      271 +struct lgrp_mem_policy_info *segop_getpolicy(struct seg *, caddr_t);
      272 +int segop_capable(struct seg *, segcapability_t);
      273 +int segop_inherit(struct seg *, caddr_t, size_t, uint_t);
 278  274  
 279  275  #endif  /* _KERNEL */
 280  276  
 281  277  #ifdef  __cplusplus
 282  278  }
 283  279  #endif
 284  280  
 285  281  #endif  /* _VM_SEG_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX