m_collapse Kernel Service

Purpose

Guarantees that an mbuf chain contains no more than a given number of mbuf structures.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/mbuf.h>

struct mbuf *m_collapse ( m,  size)
struct mbuf *m;
int size;

Parameters

Item Description
m Specifies the mbuf chain to be collapsed.
size Denotes the maximum number of mbuf structures allowed in the chain.

Description

The m_collapse kernel service reduces the number of mbuf structures in an mbuf chain to the number of mbuf structures specified by the size parameter. The m_collapse service accomplishes this by copying data into page-sized mbuf structures until the chain is of the desired length. (If required, more than one page-sized mbuf structure is used.)

Execution Environment

The m_collapse kernel service can be called from either the process or interrupt environment.

Return Values

If the chain cannot be collapsed into the number of mbuf structures specified by the size parameter, a value of null is returned and the original chain is deallocated. Upon successful completion, the head of the altered mbuf chain is returned.