Deleted Added
full compact
uipc_mbuf.c (125420) uipc_mbuf.c (125472)
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 125420 2004-02-04 08:14:47Z silby $");
37__FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 125472 2004-02-05 08:29:27Z 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>

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

870 * will be returned.
871 *
872 * If a non-packet header is passed in, the original
873 * mbuf (chain?) will be returned unharmed.
874 */
875struct mbuf *
876m_defrag(struct mbuf *m0, int how)
877{
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>

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

870 * will be returned.
871 *
872 * If a non-packet header is passed in, the original
873 * mbuf (chain?) will be returned unharmed.
874 */
875struct mbuf *
876m_defrag(struct mbuf *m0, int how)
877{
878 struct mbuf *m_new = NULL, *m_final = NULL;
879 int progress = 0, length;
878 struct mbuf *m_new = NULL, *m_final = NULL;
879 int progress = 0, length;
880
881 if (!(m0->m_flags & M_PKTHDR))
882 return (m0);
883
884 m_fixhdr(m0); /* Needed sanity check */
885
886#ifdef MBUF_STRESS_TEST
887 if (m_defragrandomfailures) {

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

962 * > 0 each fragment will be of the specified length
963 * -1 each fragment will be the same random value in length
964 * -2 each fragment's length will be entirely random
965 * (Random values range from 1 to 256)
966 */
967struct mbuf *
968m_fragment(struct mbuf *m0, int how, int length)
969{
880
881 if (!(m0->m_flags & M_PKTHDR))
882 return (m0);
883
884 m_fixhdr(m0); /* Needed sanity check */
885
886#ifdef MBUF_STRESS_TEST
887 if (m_defragrandomfailures) {

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

962 * > 0 each fragment will be of the specified length
963 * -1 each fragment will be the same random value in length
964 * -2 each fragment's length will be entirely random
965 * (Random values range from 1 to 256)
966 */
967struct mbuf *
968m_fragment(struct mbuf *m0, int how, int length)
969{
970 struct mbuf *m_new = NULL, *m_final = NULL;
971 int progress = 0;
970 struct mbuf *m_new = NULL, *m_final = NULL;
971 int progress = 0;
972
973 if (!(m0->m_flags & M_PKTHDR))
974 return (m0);
975
976 if ((length == 0) || (length < -2))
977 return (m0);
978
979 m_fixhdr(m0); /* Needed sanity check */

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

1029 return (m0);
1030}
1031
1032#endif
1033
1034struct mbuf *
1035m_uiotombuf(struct uio *uio, int how, int len)
1036{
972
973 if (!(m0->m_flags & M_PKTHDR))
974 return (m0);
975
976 if ((length == 0) || (length < -2))
977 return (m0);
978
979 m_fixhdr(m0); /* Needed sanity check */

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

1029 return (m0);
1030}
1031
1032#endif
1033
1034struct mbuf *
1035m_uiotombuf(struct uio *uio, int how, int len)
1036{
1037 struct mbuf *m_new = NULL, *m_final = NULL;
1038 int progress = 0, error = 0, length, total;
1037 struct mbuf *m_new = NULL, *m_final = NULL;
1038 int progress = 0, error = 0, length, total;
1039
1040 if (len > 0)
1041 total = min(uio->uio_resid, len);
1042 else
1043 total = uio->uio_resid;
1044 if (total > MHLEN)
1045 m_final = m_getcl(how, MT_DATA, M_PKTHDR);
1046 else

--- 34 unchanged lines hidden ---
1039
1040 if (len > 0)
1041 total = min(uio->uio_resid, len);
1042 else
1043 total = uio->uio_resid;
1044 if (total > MHLEN)
1045 m_final = m_getcl(how, MT_DATA, M_PKTHDR);
1046 else

--- 34 unchanged lines hidden ---