Merge uipc_socket2.c:1.148 from HEAD to RELENG_6:

Re-comment sbcompress() to explain what it is it does; it took me
  quite a bit of reading to figure it out, and I want to avoid figuring
  it out again.

  Convert an if (foo) else printf("this is almost a panic") into a
  KASSERT.

Approved by:	re (scottl)
This commit is contained in:
rwatson 2005-09-21 15:30:54 +00:00
parent fa502534e3
commit 37c3665582

View File

@ -1027,9 +1027,24 @@ sbappendcontrol(sb, m0, control)
}
/*
* Compress mbuf chain m into the socket
* buffer sb following mbuf n. If n
* is null, the buffer is presumed empty.
* Append the data in mbuf chain (m) into the socket buffer sb following mbuf
* (n). If (n) is NULL, the buffer is presumed empty.
*
* When the data is compressed, mbufs in the chain may be handled in one of
* three ways:
*
* (1) The mbuf may simply be dropped, if it contributes nothing (no data, no
* record boundary, and no change in data type).
*
* (2) The mbuf may be coalesced -- i.e., data in the mbuf may be copied into
* an mbuf already in the socket buffer. This can occur if an
* appropriate mbuf exists, there is room, and no merging of data types
* will occur.
*
* (3) The mbuf may be appended to the end of the existing mbuf chain.
*
* If any of the new mbufs is marked as M_EOR, mark the last mbuf appended as
* end-of-record.
*/
void
sbcompress(sb, m, n)
@ -1080,10 +1095,8 @@ sbcompress(sb, m, n)
n->m_next = 0;
}
if (eor) {
if (n)
n->m_flags |= eor;
else
printf("semi-panic: sbcompress\n");
KASSERT(n != NULL, ("sbcompress: eor && n == NULL"));
n->m_flags |= eor;
}
SBLASTMBUFCHK(sb);
}