Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Nov 2011 09:39:50 -0500
From:      Keith Arner <vornum@gmail.com>
To:        freebsd-net@freebsd.org
Subject:   "writable" variable in m_pulldown()
Message-ID:  <CAEo_tUH4TcdpdZDe06-38-89ff6mOVBB2=WZq%2B8Snp-NCM-0TA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAEo_tUH4TcdpdZDe06-38-89ff6mOVBB2=WZq%2B8Snp-NCM-0TA>