"writable" variable in m_pulldown()

Keith Arner vornum at gmail.com
Wed Nov 16 15:05:19 UTC 2011


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."


More information about the freebsd-net mailing list