Deleted Added
full compact
uipc_mbuf.c (143761) uipc_mbuf.c (145883)
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 143761 2005-03-17 19:34:57Z jmg $");
33__FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 145883 2005-05-04 18:55:03Z emax $");
34
35#include "opt_mac.h"
36#include "opt_param.h"
37#include "opt_mbuf_stress_test.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>

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

1328 m_freem(m_final);
1329 /* Return the original chain on failure */
1330 return (m0);
1331}
1332
1333#endif
1334
1335struct mbuf *
34
35#include "opt_mac.h"
36#include "opt_param.h"
37#include "opt_mbuf_stress_test.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>

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

1328 m_freem(m_final);
1329 /* Return the original chain on failure */
1330 return (m0);
1331}
1332
1333#endif
1334
1335struct mbuf *
1336m_uiotombuf(struct uio *uio, int how, int len)
1336m_uiotombuf(struct uio *uio, int how, int len, int align)
1337{
1338 struct mbuf *m_new = NULL, *m_final = NULL;
1339 int progress = 0, error = 0, length, total;
1340
1341 if (len > 0)
1342 total = min(uio->uio_resid, len);
1343 else
1344 total = uio->uio_resid;
1337{
1338 struct mbuf *m_new = NULL, *m_final = NULL;
1339 int progress = 0, error = 0, length, total;
1340
1341 if (len > 0)
1342 total = min(uio->uio_resid, len);
1343 else
1344 total = uio->uio_resid;
1345 if (total > MHLEN)
1345 if (align >= MHLEN)
1346 goto nospace;
1347 if (total + align > MHLEN)
1346 m_final = m_getcl(how, MT_DATA, M_PKTHDR);
1347 else
1348 m_final = m_gethdr(how, MT_DATA);
1349 if (m_final == NULL)
1350 goto nospace;
1348 m_final = m_getcl(how, MT_DATA, M_PKTHDR);
1349 else
1350 m_final = m_gethdr(how, MT_DATA);
1351 if (m_final == NULL)
1352 goto nospace;
1353 m_final->m_data += align;
1351 m_new = m_final;
1352 while (progress < total) {
1353 length = total - progress;
1354 if (length > MCLBYTES)
1355 length = MCLBYTES;
1356 if (m_new == NULL) {
1357 if (length > MLEN)
1358 m_new = m_getcl(how, MT_DATA, 0);

--- 23 unchanged lines hidden ---
1354 m_new = m_final;
1355 while (progress < total) {
1356 length = total - progress;
1357 if (length > MCLBYTES)
1358 length = MCLBYTES;
1359 if (m_new == NULL) {
1360 if (length > MLEN)
1361 m_new = m_getcl(how, MT_DATA, 0);

--- 23 unchanged lines hidden ---