M_TAG(9)

πŸ“¦ version 11.0, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so bestie, welcome to M_TAG(9) from the Kernel Developer’s Manual β€” this is the mbuf-tagging crew: m_tag, m_tag_get, m_tag_free, m_tag_prepend, m_tag_unlink, m_tag_delete, m_tag_delete_chain, m_tag_find, m_tag_copy, and m_tag_copy_chain. Their whole thing is mbuf tagging interfaces ✨

🌸 SYNOPSIS 🌸

#include <sys/mbuf.h>

struct m_tag *
m_tag_get(int type, int len, int wait);

void
m_tag_free(struct m_tag *t);

void
m_tag_prepend(struct mbuf *m, struct m_tag *t);

void
m_tag_unlink(struct mbuf *m, struct m_tag *t);

void
m_tag_delete(struct mbuf *m, struct m_tag *t);

void
m_tag_delete_chain(struct mbuf *m);

struct m_tag *
m_tag_find(struct mbuf *m, int type);

struct m_tag *
m_tag_copy(struct m_tag *m);

int
m_tag_copy_chain(struct mbuf *to, struct mbuf *from);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the m_tag interface is used to β€œtag” mbufs. That’s the whole plot, no cap. πŸ’…

πŸ”₯ FUNCTIONS πŸ”₯

  • m_tag_get(type, len, wait) β€” allocates an mbuf tag. type is one of the PACKET_TAG_ macros. len is the size of the data associated with the tag, in bytes. wait is either M_WAITOK or M_NOWAIT. πŸŽ€
  • m_tag_free(t) β€” frees the mbuf tag t. 🧚
  • m_tag_prepend(m, t) β€” prepends the mbuf tag t to the mbuf m. t will become the first tag of the mbuf m. When m is freed, t will also be freed. πŸ¦‹
  • m_tag_unlink(m, t) β€” unlinks the mbuf tag t from the mbuf m. πŸ’…
  • m_tag_delete(m, t) β€” the same as m_tag_unlink() followed by m_tag_free(). 🫢
  • m_tag_delete_chain(m) β€” unlinks and frees mbuf tags from the mbuf m. πŸ“
  • m_tag_find(m, type) β€” finds an mbuf tag with type type in the tag chain associated with the mbuf m. If an mbuf tag is found, return a pointer to it. Otherwise return NULL. πŸ”
  • m_tag_copy(t) β€” copies an mbuf tag t. Returns a new mbuf tag on success. Otherwise returns NULL. ✨
  • m_tag_copy_chain(to, from) β€” copies all mbuf tags associated with the mbuf from to the mbuf to. If to already has any mbuf tags, they will be unlinked and freed beforehand. Returns 1 on success. Otherwise returns 0. πŸ‘‘

⭐ CODE REFERENCES ⭐

The mbuf tagging interfaces are implemented within the file sys/kern/uipc_mbuf.c. πŸ› οΈ

The PACKET_TAG_ macros are defined in the file sys/sys/mbuf.h. πŸ“š

🌈 SEE ALSO 🌈

πŸ’€ BUGS πŸ’€

The semantics of the term "persistent tag" are vague. lowkey mysterious, highkey vague. πŸ™ˆ


okay that’s the page, bestie β€” source/version is Debian, dated November 15, 2018, and this whole thing is M_TAG(9). bye bestie, go tag those mbufs πŸ’–βœ¨πŸ«Ά

πŸ“¦ where this page comes from