* XXX: m_cljset() is a dangerous API. One must attach only a new, * unreferenced cluster to an mbuf(9). It is not possible to assert * that, so care can be taken only by users of the API. */
| 992 | * that, so care can be taken only by users of the API. |
| 993 | */ |
| 994 | static __inline void |
| 995 | m_cljset(struct mbuf *m, void *cl, int type) |
| 996 | { |
| 997 | int size; |
| 998 | |
| 999 | switch (type) { |
| 1000 | case EXT_CLUSTER: |
| 1001 | size = MCLBYTES; |
| 1002 | break; |
| 1003 | #if MJUMPAGESIZE != MCLBYTES |
| 1004 | case EXT_JUMBOP: |
| 1005 | size = MJUMPAGESIZE; |
| 1006 | break; |
| 1007 | #endif |
| 1008 | case EXT_JUMBO9: |
| 1009 | size = MJUM9BYTES; |
| 1010 | break; |
| 1011 | case EXT_JUMBO16: |
| 1012 | size = MJUM16BYTES; |
| 1013 | break; |
| 1014 | default: |
| 1015 | panic("%s: unknown cluster type %d", __func__, type); |
| 1016 | break; |
| 1017 | } |
| 1018 | |
| 1019 | m->m_data = m->m_ext.ext_buf = cl; |
| 1020 | m->m_ext.ext_free = m->m_ext.ext_arg1 = m->m_ext.ext_arg2 = NULL; |
| 1021 | m->m_ext.ext_size = size; |
| 1022 | m->m_ext.ext_type = type; |
| 1023 | m->m_ext.ext_flags = EXT_FLAG_EMBREF; |
| 1024 | m->m_ext.ext_count = 1; |
| 1025 | m->m_flags |= M_EXT; |
| 1026 | MBUF_PROBE3(m__cljset, m, cl, type); |
| 1027 | } |
| 1028 | |
| 1029 | static __inline void |
| 1030 | m_chtype(struct mbuf *m, short new_type) |
no test coverage detected