Deleted Added
full compact
uipc_mbuf.c (271122) uipc_mbuf.c (275329)
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

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
30 */
31
32#include <sys/cdefs.h>
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

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 271122 2014-09-04 19:27:30Z glebius $");
33__FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 275329 2014-11-30 13:24:21Z glebius $");
34
35#include "opt_param.h"
36#include "opt_mbuf_stress_test.h"
37#include "opt_mbuf_profiling.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>

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

383}
384
385/*
386 * Clean up mbuf (chain) from any tags and packet headers.
387 * If "all" is set then the first mbuf in the chain will be
388 * cleaned too.
389 */
390void
34
35#include "opt_param.h"
36#include "opt_mbuf_stress_test.h"
37#include "opt_mbuf_profiling.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>

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

383}
384
385/*
386 * Clean up mbuf (chain) from any tags and packet headers.
387 * If "all" is set then the first mbuf in the chain will be
388 * cleaned too.
389 */
390void
391m_demote(struct mbuf *m0, int all)
391m_demote(struct mbuf *m0, int all, int flags)
392{
393 struct mbuf *m;
394
395 for (m = all ? m0 : m0->m_next; m != NULL; m = m->m_next) {
396 KASSERT(m->m_nextpkt == NULL, ("%s: m_nextpkt in m %p, m0 %p",
397 __func__, m, m0));
398 if (m->m_flags & M_PKTHDR) {
399 m_tag_delete_chain(m, NULL);
400 m->m_flags &= ~M_PKTHDR;
401 bzero(&m->m_pkthdr, sizeof(struct pkthdr));
402 }
392{
393 struct mbuf *m;
394
395 for (m = all ? m0 : m0->m_next; m != NULL; m = m->m_next) {
396 KASSERT(m->m_nextpkt == NULL, ("%s: m_nextpkt in m %p, m0 %p",
397 __func__, m, m0));
398 if (m->m_flags & M_PKTHDR) {
399 m_tag_delete_chain(m, NULL);
400 m->m_flags &= ~M_PKTHDR;
401 bzero(&m->m_pkthdr, sizeof(struct pkthdr));
402 }
403 m->m_flags = m->m_flags & (M_EXT|M_RDONLY|M_NOFREE);
403 m->m_flags = m->m_flags & (M_EXT | M_RDONLY | M_NOFREE | flags);
404 }
405}
406
407/*
408 * Sanity checks on mbuf (chain) for use in KASSERT() and general
409 * debugging.
410 * Returns 0 or panics when bad and 1 on all tests passed.
411 * Sanitize, 0 to run M_SANITY_ACTION, 1 to garble things so they

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

992void
993m_catpkt(struct mbuf *m, struct mbuf *n)
994{
995
996 M_ASSERTPKTHDR(m);
997 M_ASSERTPKTHDR(n);
998
999 m->m_pkthdr.len += n->m_pkthdr.len;
404 }
405}
406
407/*
408 * Sanity checks on mbuf (chain) for use in KASSERT() and general
409 * debugging.
410 * Returns 0 or panics when bad and 1 on all tests passed.
411 * Sanitize, 0 to run M_SANITY_ACTION, 1 to garble things so they

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

992void
993m_catpkt(struct mbuf *m, struct mbuf *n)
994{
995
996 M_ASSERTPKTHDR(m);
997 M_ASSERTPKTHDR(n);
998
999 m->m_pkthdr.len += n->m_pkthdr.len;
1000 m_demote(n, 1);
1000 m_demote(n, 1, 0);
1001
1002 m_cat(m, n);
1003}
1004
1005void
1006m_adj(struct mbuf *mp, int req_len)
1007{
1008 int len = req_len;

--- 1185 unchanged lines hidden ---
1001
1002 m_cat(m, n);
1003}
1004
1005void
1006m_adj(struct mbuf *mp, int req_len)
1007{
1008 int len = req_len;

--- 1185 unchanged lines hidden ---