From owner-p4-projects@FreeBSD.ORG Tue Jul 19 22:03:24 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 83DA516A421; Tue, 19 Jul 2005 22:03:24 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6028916A41F for ; Tue, 19 Jul 2005 22:03:24 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 32AF043D46 for ; Tue, 19 Jul 2005 22:03:24 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j6JM3Oi0093027 for ; Tue, 19 Jul 2005 22:03:24 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j6JM3NaI093024 for perforce@freebsd.org; Tue, 19 Jul 2005 22:03:23 GMT (envelope-from sam@freebsd.org) Date: Tue, 19 Jul 2005 22:03:23 GMT Message-Id: <200507192203.j6JM3NaI093024@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 80557 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2005 22:03:25 -0000 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 *);