Deleted Added
full compact
uipc_mbuf.c (81908) uipc_mbuf.c (87594)
1/*
2 * Copyright (c) 1982, 1986, 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
1/*
2 * Copyright (c) 1982, 1986, 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
34 * $FreeBSD: head/sys/kern/uipc_mbuf.c 81907 2001-08-19 04:30:13Z julian $
34 * $FreeBSD: head/sys/kern/uipc_mbuf.c 87594 2001-12-10 05:51:45Z obrien $
35 */
36
37#include "opt_param.h"
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/kernel.h>
41#include <sys/lock.h>
42#include <sys/malloc.h>

--- 293 unchanged lines hidden (view full) ---

336m_dup(struct mbuf *m, int how)
337{
338 struct mbuf **p, *top = NULL;
339 int remain, moff, nsize;
340
341 /* Sanity check */
342 if (m == NULL)
343 return (NULL);
35 */
36
37#include "opt_param.h"
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/kernel.h>
41#include <sys/lock.h>
42#include <sys/malloc.h>

--- 293 unchanged lines hidden (view full) ---

336m_dup(struct mbuf *m, int how)
337{
338 struct mbuf **p, *top = NULL;
339 int remain, moff, nsize;
340
341 /* Sanity check */
342 if (m == NULL)
343 return (NULL);
344 KASSERT((m->m_flags & M_PKTHDR) != 0, ("%s: !PKTHDR", __FUNCTION__));
344 KASSERT((m->m_flags & M_PKTHDR) != 0, ("%s: !PKTHDR", __func__));
345
346 /* While there's more data, get a new mbuf, tack it on, and fill it */
347 remain = m->m_pkthdr.len;
348 moff = 0;
349 p = &top;
350 while (remain > 0 || top == NULL) { /* allow m->m_pkthdr.len == 0 */
351 struct mbuf *n;
352

--- 31 unchanged lines hidden (view full) ---

384 if (moff == m->m_len) {
385 m = m->m_next;
386 moff = 0;
387 }
388 }
389
390 /* Check correct total mbuf length */
391 KASSERT((remain > 0 && m != NULL) || (remain == 0 && m == NULL),
345
346 /* While there's more data, get a new mbuf, tack it on, and fill it */
347 remain = m->m_pkthdr.len;
348 moff = 0;
349 p = &top;
350 while (remain > 0 || top == NULL) { /* allow m->m_pkthdr.len == 0 */
351 struct mbuf *n;
352

--- 31 unchanged lines hidden (view full) ---

384 if (moff == m->m_len) {
385 m = m->m_next;
386 moff = 0;
387 }
388 }
389
390 /* Check correct total mbuf length */
391 KASSERT((remain > 0 && m != NULL) || (remain == 0 && m == NULL),
392 ("%s: bogus m_pkthdr.len", __FUNCTION__));
392 ("%s: bogus m_pkthdr.len", __func__));
393 }
394 return (top);
395
396nospace:
397 m_freem(top);
398 mbstat.m_mcfail++; /* XXX: No consistency. */
399 return (NULL);
400}

--- 352 unchanged lines hidden ---
393 }
394 return (top);
395
396nospace:
397 m_freem(top);
398 mbstat.m_mcfail++; /* XXX: No consistency. */
399 return (NULL);
400}

--- 352 unchanged lines hidden ---