* Set the m_data pointer of a newly allocated mbuf to place an object of the * specified size at the end of the mbuf, longword aligned. * * NB: Historically, we had M_ALIGN(), MH_ALIGN(), and MEXT_ALIGN() as * separate macros, each asserting that it was called at the proper moment. * This required callers to themselves test the storage type and call the * right one. Rather than require call
| 1134 | * decisions, we centralize here. |
| 1135 | */ |
| 1136 | static __inline void |
| 1137 | m_align(struct mbuf *m, int len) |
| 1138 | { |
| 1139 | #ifdef INVARIANTS |
| 1140 | const char *msg = "%s: not a virgin mbuf"; |
| 1141 | #endif |
| 1142 | int adjust; |
| 1143 | |
| 1144 | KASSERT(m->m_data == M_START(m), (msg, __func__)); |
| 1145 | |
| 1146 | adjust = M_SIZE(m) - len; |
| 1147 | m->m_data += adjust &~ (sizeof(long)-1); |
| 1148 | } |
| 1149 | |
| 1150 | #define M_ALIGN(m, len) m_align(m, len) |
| 1151 | #define MH_ALIGN(m, len) m_align(m, len) |
no outgoing calls
no test coverage detected