Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Nov 2012 14:33:29 +0100
From:      Andre Oppermann <andre@freebsd.org>
To:        Gleb Smirnoff <glebius@FreeBSD.org>
Cc:        src-committers@FreeBSD.org, svn-src-user@FreeBSD.org
Subject:   Re: svn commit: r243215 - user/andre/tcp_workqueue/sys/sys
Message-ID:  <50AA3529.2030300@freebsd.org>
In-Reply-To: <20121119114510.GQ38060@FreeBSD.org>
References:  <201211181217.qAICH7aH021497@svn.freebsd.org> <20121119114510.GQ38060@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 19.11.2012 12:45, Gleb Smirnoff wrote:
> On Sun, Nov 18, 2012 at 12:17:07PM +0000, Andre Oppermann wrote:
> A> Author: andre
> A> Date: Sun Nov 18 12:17:07 2012
> A> New Revision: 243215
> A> URL: http://svnweb.freebsd.org/changeset/base/243215
> A>
> A> Log:
> A>   Add mtodo(m, o, t) macro taking an additional offset into
> A>   the mbuf data section before the casting to type 't'.
>
> IMHO, argument order of (m, t, o) is more intuitive, since
> matches order of mtod().

Yes, but that looks rather horrible and counter-intuitive:

  th = mtodo(m, struct tcphdr *, 20);

vs.

  th = mtodo(m, 20, struct tcphdr *);

Reads m->m_data at offset 20 is struct tcphdr.

Naming it mtood() wasn't convincing either. ;-)

-- 
Andre

> A>
> A> Modified:
> A>   user/andre/tcp_workqueue/sys/sys/mbuf.h
> A>
> A> Modified: user/andre/tcp_workqueue/sys/sys/mbuf.h
> A> ==============================================================================
> A> --- user/andre/tcp_workqueue/sys/sys/mbuf.h	Sun Nov 18 12:16:50 2012	(r243214)
> A> +++ user/andre/tcp_workqueue/sys/sys/mbuf.h	Sun Nov 18 12:17:07 2012	(r243215)
> A> @@ -64,8 +64,10 @@
> A>   * type:
> A>   *
> A>   * mtod(m, t)	-- Convert mbuf pointer to data pointer of correct type.
> A> + * mtodo(m, o, t) - Same as above but with offset 'o' into data.
> A>   */
> A>  #define	mtod(m, t)	((t)((m)->m_data))
> A> +#define	mtodo(m, o, t)	((t)(((m)->m_data) + (o)))
> A>
> A>  /*
> A>   * Argument structure passed to UMA routines during mbuf and packet
>




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