X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/1c15e88899094343f75aeba04122cd96a96b428e..ad7871609881e73855d0b04da49b486cd93efca7:/usr/src/sys/netiso/iso_chksum.c diff --git a/usr/src/sys/netiso/iso_chksum.c b/usr/src/sys/netiso/iso_chksum.c index dafc242773..5b1aae59e1 100644 --- a/usr/src/sys/netiso/iso_chksum.c +++ b/usr/src/sys/netiso/iso_chksum.c @@ -1,3 +1,38 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)iso_chksum.c 8.1 (Berkeley) 6/10/93 + */ + /*********************************************************** Copyright IBM Corporation 1987 @@ -27,7 +62,6 @@ SOFTWARE. /* * $Header: iso_chksum.c,v 4.7 88/07/29 15:31:26 nhall Exp $ * $Source: /usr/argo/sys/netiso/RCS/iso_chksum.c,v $ - * @(#)iso_chksum.c 7.4 (Berkeley) 9/26/89 * * * ISO CHECKSUM * @@ -49,18 +83,15 @@ SOFTWARE. */ #ifdef ISO -#ifndef lint -static char *rcsid = "$Header: iso_chksum.c,v 4.7 88/07/29 15:31:26 nhall Exp $"; -#endif - -#include "argo_debug.h" -#include "param.h" -#include "mbuf.h" -#endif ISO +#include +#include +#include +#include +#endif /* ISO */ #ifndef MNULL #define MNULL (struct mbuf *)0 -#endif MNULL +#endif /* MNULL */ /* * FUNCTION: iso_check_csum @@ -91,7 +122,7 @@ iso_check_csum(m, len) int l; l = len; - len = MIN(m->m_len, len); + len = min(m->m_len, len); i = 0; IFDEBUG(D_CHKSUM) @@ -115,7 +146,7 @@ iso_check_csum(m, len) l,i,m->m_data); ENDDEBUG ASSERT( m != MNULL); - len = MIN( m->m_len, l-i); + len = min( m->m_len, l-i); p = mtod(m, u_char *); } } @@ -167,9 +198,9 @@ iso_gen_csum(m,n,l) ENDDEBUG while(i < l) { - len = MIN(m->m_len, CLBYTES); + len = min(m->m_len, CLBYTES); /* RAH: don't cksum more than l bytes */ - len = MIN(len, l - i); + len = min(len, l - i); cum +=len; p = mtod(m, u_char *); @@ -223,22 +254,6 @@ iso_gen_csum(m,n,l) ENDDEBUG } -struct mbuf * -m_append(head, m) - struct mbuf *head, *m; -{ - register struct mbuf *n; - - if (m == 0) - return head; - if (head == 0) - return m; - n = head; - while (n->m_next) - n = n->m_next; - n->m_next = m; - return head; -} /* * FUNCTION: m_datalen * @@ -253,23 +268,13 @@ m_append(head, m) */ int -m_datalen (morig) - struct mbuf *morig; +m_datalen (m) + register struct mbuf *m; { - int s = splimp(); - register struct mbuf *n=morig; - register int datalen = 0; + register int datalen; - if( morig == (struct mbuf *)0) - return 0; - for(;;) { - datalen += n->m_len; - if (n->m_next == (struct mbuf *)0 ) { - break; - } - n = n->m_next; - } - splx(s); + for (datalen = 0; m; m = m->m_next) + datalen += m->m_len; return datalen; } @@ -318,7 +323,7 @@ m_compress(in, out) int len; len = M_TRAILINGSPACE(*out); - len = MIN(len, in->m_len); + len = min(len, in->m_len); datalen += len; IFDEBUG(D_REQUEST)