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

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

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 */
35
36#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

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

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 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 116455 2003-06-17 02:34:40Z silby $");
37__FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 117770 2003-07-19 06:03:48Z silby $");
38
39#include "opt_mac.h"
40#include "opt_param.h"
41#include "opt_mbuf_stress_test.h"
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/kernel.h>

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

155 * allocate new mbuf to prepend to chain,
156 * copy junk along.
157 */
158struct mbuf *
159m_prepend(struct mbuf *m, int len, int how)
160{
161 struct mbuf *mn;
162
38
39#include "opt_mac.h"
40#include "opt_param.h"
41#include "opt_mbuf_stress_test.h"
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/kernel.h>

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

155 * allocate new mbuf to prepend to chain,
156 * copy junk along.
157 */
158struct mbuf *
159m_prepend(struct mbuf *m, int len, int how)
160{
161 struct mbuf *mn;
162
163 MGET(mn, how, m->m_type);
163 if (m->m_flags & M_PKTHDR)
164 MGETHDR(mn, how, m->m_type);
165 else
166 MGET(mn, how, m->m_type);
164 if (mn == NULL) {
165 m_freem(m);
166 return (NULL);
167 }
168 if (m->m_flags & M_PKTHDR)
169 M_MOVE_PKTHDR(mn, m);
170 mn->m_next = m;
171 m = mn;

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

204 np = &top;
205 top = 0;
206 while (len > 0) {
207 if (m == NULL) {
208 KASSERT(len == M_COPYALL,
209 ("m_copym, length > size of mbuf chain"));
210 break;
211 }
167 if (mn == NULL) {
168 m_freem(m);
169 return (NULL);
170 }
171 if (m->m_flags & M_PKTHDR)
172 M_MOVE_PKTHDR(mn, m);
173 mn->m_next = m;
174 m = mn;

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

207 np = &top;
208 top = 0;
209 while (len > 0) {
210 if (m == NULL) {
211 KASSERT(len == M_COPYALL,
212 ("m_copym, length > size of mbuf chain"));
213 break;
214 }
212 MGET(n, wait, m->m_type);
215 if (copyhdr)
216 MGETHDR(n, wait, m->m_type);
217 else
218 MGET(n, wait, m->m_type);
213 *np = n;
214 if (n == NULL)
215 goto nospace;
216 if (copyhdr) {
217 if (!m_dup_pkthdr(n, m, wait))
218 goto nospace;
219 if (len == M_COPYALL)
220 n->m_pkthdr.len -= off0;

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

807m_defrag(struct mbuf *m0, int how)
808{
809 struct mbuf *m_new = NULL, *m_final = NULL;
810 int progress = 0, length;
811
812 if (!(m0->m_flags & M_PKTHDR))
813 return (m0);
814
219 *np = n;
220 if (n == NULL)
221 goto nospace;
222 if (copyhdr) {
223 if (!m_dup_pkthdr(n, m, wait))
224 goto nospace;
225 if (len == M_COPYALL)
226 n->m_pkthdr.len -= off0;

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

813m_defrag(struct mbuf *m0, int how)
814{
815 struct mbuf *m_new = NULL, *m_final = NULL;
816 int progress = 0, length;
817
818 if (!(m0->m_flags & M_PKTHDR))
819 return (m0);
820
821 m_fixhdr(m0); /* Needed sanity check */
822
815#ifdef MBUF_STRESS_TEST
816 if (m_defragrandomfailures) {
817 int temp = arc4random() & 0xff;
818 if (temp == 0xba)
819 goto nospace;
820 }
821#endif
822

--- 55 unchanged lines hidden ---
823#ifdef MBUF_STRESS_TEST
824 if (m_defragrandomfailures) {
825 int temp = arc4random() & 0xff;
826 if (temp == 0xba)
827 goto nospace;
828 }
829#endif
830

--- 55 unchanged lines hidden ---