Print this page
use NULL capable segop as a shorthand for no-capabilities
Instead of forcing every segment driver to implement a dummy "return 0"
function, handle NULL capable segop function pointer as "no copabilities
supported" shorthand.

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/vm/vm_seg.c
          +++ new/usr/src/uts/common/vm/vm_seg.c
↓ open down ↓ 2023 lines elided ↑ open up ↑
2024 2024  {
2025 2025          if (seg->s_ops->getpolicy == NULL)
2026 2026                  return (NULL);
2027 2027  
2028 2028          return (seg->s_ops->getpolicy(seg, addr));
2029 2029  }
2030 2030  
2031 2031  int
2032 2032  segop_capable(struct seg *seg, segcapability_t cap)
2033 2033  {
2034      -        VERIFY3P(seg->s_ops->capable, !=, NULL);
     2034 +        if (seg->s_ops->capable == NULL)
     2035 +                return (0);
2035 2036  
2036 2037          return (seg->s_ops->capable(seg, cap));
2037 2038  }
2038 2039  
2039 2040  int
2040 2041  segop_inherit(struct seg *seg, caddr_t addr, size_t len, uint_t op)
2041 2042  {
2042 2043          if (seg->s_ops->inherit == NULL)
2043 2044                  return (ENOTSUP);
2044 2045  
2045 2046          return (seg->s_ops->inherit(seg, addr, len, op));
2046 2047  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX