--- - branch: MAIN date: Wed Apr 12 06:48:08 UTC 2023 files: - new: '1.251' old: '1.250' path: src/sys/kern/uipc_mbuf.c pathrev: src/sys/kern/uipc_mbuf.c@1.251 type: modified - new: '1.238' old: '1.237' path: src/sys/sys/mbuf.h pathrev: src/sys/sys/mbuf.h@1.238 type: modified id: 20230412T064808Z.1a49a8182be7438eef3452584b4cf88f5c84fdb3 log: | mbuf(9): New m_get_n, m_gethdr_n. m_get_n(how, type, alignbytes, nbytes) returns an mbuf with no packet header having space for nbytes, with an internal buffer pointer aligned by alignbytes (typically ETHER_ALIGN or similar, if not zero). m_gethdr_n(how, type, alignbytes, nbytes) does the same but for an mbuf with a packet header. These return NULL on failure, which can happen either: (a) because how is M_DONTWAIT and allocating memory would sleep, or (b) because alignbytes + nbytes > MCLBYTES. On exit, m_len is set to nbytes, as is m_pkthdr.len for m_gethdr_n. These should be used to systematically replace all calls to m_get, m_gethdr, MGET, MGETHDR, and m_getcl. Most calls to m_clget and MCLGET will probably evaporate as a consequence. Proposed on tech-net last year: https://mail-index.netbsd.org/tech-net/2022/07/16/msg008285.html module: src subject: 'CVS commit: src/sys' unixtime: '1681282088' user: riastradh