From owner-svn-src-head@FreeBSD.ORG Mon Aug 26 14:21:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B8A807DE for ; Mon, 26 Aug 2013 14:21:36 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2821C2782 for ; Mon, 26 Aug 2013 14:21:35 +0000 (UTC) Received: (qmail 6749 invoked from network); 26 Aug 2013 15:03:46 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 26 Aug 2013 15:03:46 -0000 Message-ID: <521B646B.7080209@freebsd.org> Date: Mon, 26 Aug 2013 16:21:31 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Gleb Smirnoff Subject: Re: svn commit: r254805 - head/sys/sys References: <201308241958.r7OJwaxV031368@svn.freebsd.org> <20130826110007.GR4574@FreeBSD.org> In-Reply-To: <20130826110007.GR4574@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Aug 2013 14:21:36 -0000 On 26.08.2013 13:00, Gleb Smirnoff wrote: > On Sat, Aug 24, 2013 at 07:58:36PM +0000, Andre Oppermann wrote: > A> Author: andre > A> Date: Sat Aug 24 19:58:36 2013 > A> New Revision: 254805 > A> URL: http://svnweb.freebsd.org/changeset/base/254805 > A> > A> Log: > A> Add mtodo(m, o) macro taking an additional offset into the mbuf data section. > A> > A> Sponsored by: The FreeBSD Foundation > A> > A> Modified: > A> head/sys/sys/mbuf.h > A> > A> Modified: head/sys/sys/mbuf.h > A> ============================================================================== > A> --- head/sys/sys/mbuf.h Sat Aug 24 19:51:18 2013 (r254804) > A> +++ head/sys/sys/mbuf.h Sat Aug 24 19:58:36 2013 (r254805) > A> @@ -67,8 +67,10 @@ > A> * type: > A> * > A> * mtod(m, t) -- Convert mbuf pointer to data pointer of correct type. > A> + * mtodo(m, o) -- Same as above but with offset 'o' into data. > A> */ > A> #define mtod(m, t) ((t)((m)->m_data)) > A> +#define mtodo(m, o) ((void *)(((m)->m_data) + (o))) > > IMO, having a typecast would be better. Then mtodo() would be really same as > mtod(), as stated in comment. There was a big discussion about 10 month back when I did this change in my tcp_workqueue branch with the typecast in. The conclusion was that a typecast is really not necessary and only causes one to type a lot more for the compiler to throw away anyway. But yes, the comment isn't perfect in that sense. -- Andre