Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jul 2005 22:03:23 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 80557 for review
Message-ID:  <200507192203.j6JM3NaI093024@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=80557

Change 80557 by sam@sam_ebb on 2005/07/19 22:03:05

	add m_align; a function that aligns an arbitrary mbuf

Affected files ...

.. //depot/projects/wifi/sys/kern/uipc_mbuf.c#11 edit
.. //depot/projects/wifi/sys/sys/mbuf.h#11 edit

Differences ...

==== //depot/projects/wifi/sys/kern/uipc_mbuf.c#11 (text+ko) ====

@@ -1382,3 +1382,22 @@
 		m_freem(m_final);
 	return (NULL);
 }
+
+/*
+ * 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.
+ */
+void
+m_align(struct mbuf *m, int len)
+{
+	int adjust;
+
+	if (m->m_flags & M_EXT)
+		adjust = m->m_ext.ext_size - len;
+	else if (m->m_flags & M_PKTHDR)
+		adjust = MHLEN - len;
+	else
+		adjust = MLEN - len;
+	m->m_data += adjust &~ (sizeof(long)-1);
+}

==== //depot/projects/wifi/sys/sys/mbuf.h#11 (text+ko) ====

@@ -562,6 +562,7 @@
 
 struct uio;
 
+void		 m_align(struct mbuf *, int);
 void		 m_adj(struct mbuf *, int);
 int		 m_apply(struct mbuf *, int, int,
 		    int (*)(void *, void *, u_int), void *);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507192203.j6JM3NaI093024>