PERFORCE change 80557 for review

Sam Leffler sam at FreeBSD.org
Tue Jul 19 22:03:25 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=80557

Change 80557 by sam at 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 *);


More information about the p4-projects mailing list