From owner-svn-src-user@FreeBSD.ORG Mon Nov 19 18:16:25 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 29439A51; Mon, 19 Nov 2012 18:16:25 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id CBAF18FC13; Mon, 19 Nov 2012 18:16:24 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id wz12so3815559pbc.13 for ; Mon, 19 Nov 2012 10:16:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=X4irGxOUzO3CVVY2i3AivEAG1iXiL+sRGTOo577FpLQ=; b=NfinrCWaotc0y3s8ock+V1WPVpwc7TyN7QwR+ZAWVO0qInzk7QSIb5I8OlHC0HAYaW Y7EttCPduPEuAIVClMnyJHfDsspRm335ufDQlZ37YfBY9SYW5Mfp+dJv2kzf9xuPtlIq RfM896v9EUhc+P76VpS3NnI0fGA03pKCJfsh9On/yKURKJYUu6Bt6HOgRgmgiMedPRGg 2XV1b37kKS3dP5GO67+RX+ZwAXWES8mvfNxy2UM3XpRCVmhfIyUpgM6PUC5n/5Fr/LCb MNw99PRBaENq0NzabeT9ucN6TfmkWEnod6ouonhy8+OKwTLvAwoa8pzW1ZTz0m9IDKAJ eBeQ== Received: by 10.66.77.39 with SMTP id p7mr550084paw.8.1353348983736; Mon, 19 Nov 2012 10:16:23 -0800 (PST) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPS id t1sm6541880paw.11.2012.11.19.10.16.21 (version=SSLv3 cipher=OTHER); Mon, 19 Nov 2012 10:16:22 -0800 (PST) Sender: Navdeep Parhar Message-ID: <50AA7773.1050401@FreeBSD.org> Date: Mon, 19 Nov 2012 10:16:19 -0800 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:16.0) Gecko/20121114 Thunderbird/16.0.2 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r243215 - user/andre/tcp_workqueue/sys/sys References: <201211181217.qAICH7aH021497@svn.freebsd.org> <20121119114510.GQ38060@FreeBSD.org> <50AA3529.2030300@freebsd.org> <50AA76CD.3070904@freebsd.org> In-Reply-To: <50AA76CD.3070904@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: mdf@FreeBSD.org, Gleb Smirnoff , src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Nov 2012 18:16:25 -0000 On 11/19/12 10:13, Andre Oppermann wrote: > On 19.11.2012 18:01, mdf@FreeBSD.org wrote: >> On Mon, Nov 19, 2012 at 5:33 AM, Andre Oppermann >> wrote: >>> 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. ;-) >> >> Why a cast at all? Perpetuating the mistake of mtod()'s casting isn't >> necessary. mtod() can't be fixed for source reasons, but the new one >> doesn't need to cast. Since C automatically casts from void * to any >> other pointer, the code gets shorter (usually) too: >> >> th = mtodo(m, 20); > > m->m_data is caddr_t which is "char *" No matter what it is you can always cast it to void * before returning, instead of having the caller supply the type. Navdeep > >> Not that I care much, it's just if we're having a bikeshed I have my >> favorite colors. :-) >