From owner-freebsd-net@FreeBSD.ORG Wed Nov 16 15:05:19 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45918106566C for ; Wed, 16 Nov 2011 15:05:19 +0000 (UTC) (envelope-from keith.arner@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id D5C128FC14 for ; Wed, 16 Nov 2011 15:05:18 +0000 (UTC) Received: by wwg14 with SMTP id 14so870095wwg.31 for ; Wed, 16 Nov 2011 07:05:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=eINlFRcAmDjr/dNUp8jOcXL1bFEsTxIjCvuL7P9dRmQ=; b=PhmZldX6R/mq2X1Einy4KBspE9ohsH77sEnTiVdgE+/2snM3OKa6k+vezu0F/afysX 5S7D8QCMOuGDVKHXEUvldeARWeBkTGbflAJI4pNYP7NPkHlB3gVorLsZFsCPBPOoDG8u Xx5hw3AqcTHfVPxR2IHpS7tGMxWQKAlspvxBo= MIME-Version: 1.0 Received: by 10.52.33.140 with SMTP id r12mr51711377vdi.36.1321454390376; Wed, 16 Nov 2011 06:39:50 -0800 (PST) Sender: keith.arner@gmail.com Received: by 10.52.111.70 with HTTP; Wed, 16 Nov 2011 06:39:50 -0800 (PST) Date: Wed, 16 Nov 2011 09:39:50 -0500 X-Google-Sender-Auth: -D53ne-bjp8jS5n7ZZ7JhCgz4BM Message-ID: From: Keith Arner To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: "writable" variable in m_pulldown() X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 15:05:19 -0000 I'm trying to make sense out of the use of the variable "writable" in the function m_pulldown(). In particular, how writable is used on the line: if ((off == 0 || offp) && len <= n->m_len - off && writable) goto ok; If the first two conditions in this test (off/offp and len) hold true, then the requested data is already contiguous, and at a position that the requestor is satisfied with -- in other words, no modifications are necessary. However, the use of writable in this test prevents an otherwise satisfactory buffer from fulfilling the request. The other two uses of writable in m_pulldown() make sense (i.e in conjunction with M_TRAILINGSPACE() or M_LEADINGSPACE()). In both those cases m_pulldown() is scribbling to the data region, which is only kosher on a writable buffer. It is the first use of writable, where no data modification is needed, that has me confused. Is there something subtle going on with the first use of writable? Keith -- "A problem well put is half solved."