From owner-freebsd-current Wed Feb 6 3:33: 8 2002 Delivered-To: freebsd-current@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id BF82E37B400; Wed, 6 Feb 2002 03:33:01 -0800 (PST) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id g16BX1P98030; Wed, 6 Feb 2002 03:33:01 -0800 (PST) (envelope-from dillon) Date: Wed, 6 Feb 2002 03:33:01 -0800 (PST) From: Matthew Dillon Message-Id: <200202061133.g16BX1P98030@apollo.backplane.com> To: Ruslan Ermilov Cc: current@FreeBSD.ORG Subject: Re: MFREE() References: <20020206094851.A51808@sunbay.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :The following files under sys/ still use MFREE(): : :alpha/tc/am7990.c :netatm/port.h :security/lomac/kernel_socket.c : :Please fix. : : :Cheers, :-- :Ruslan Ermilov Sysadmin and DBA, Please review the following patch. Note that the KB_ macros in netatm could be further rewritten and the (one line of) code that uses them could be cleaned up, but I only made the minimum changes necessary to remove MFREE(). I did rewrite the tangle of code in am7990.c, it's about an order of magnitude easier to read now. -Matt Index: alpha/tc/am7990.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/tc/am7990.c,v retrieving revision 1.12 diff -u -r1.12 am7990.c --- alpha/tc/am7990.c 14 Jun 2001 19:36:37 -0000 1.12 +++ alpha/tc/am7990.c 6 Feb 2002 11:24:51 -0000 @@ -442,19 +442,16 @@ int boff; register struct mbuf *m; { - register struct mbuf *n; register int len, tlen = 0; - for (; m; m = n) { + while (m) { len = m->m_len; - if (len == 0) { - MFREE(m, n); - continue; + if (len != 0) { + (*sc->sc_copytobuf)(sc, mtod(m, caddr_t), boff, len); + boff += len; + tlen += len; } - (*sc->sc_copytobuf)(sc, mtod(m, caddr_t), boff, len); - boff += len; - tlen += len; - MFREE(m, n); + m = m_free(m); } if (tlen < LEMINSIZE) { (*sc->sc_zerobuf)(sc, boff, LEMINSIZE - tlen); Index: netatm/port.h =================================================================== RCS file: /home/ncvs/src/sys/netatm/port.h,v retrieving revision 1.5 diff -u -r1.5 port.h --- netatm/port.h 20 Mar 2001 10:42:48 -0000 1.5 +++ netatm/port.h 6 Feb 2002 11:27:06 -0000 @@ -274,10 +274,10 @@ (prev)->m_next = (new); \ } #define KB_UNLINKHEAD(head, next) { \ - MFREE((head), (next)); \ + (next) = m_free(head); \ } #define KB_UNLINK(old, prev, next) { \ - MFREE((old), (next)); \ + (next) = m_free(old); \ (prev)->m_next = (next); \ } #define KB_ISPKT(bfr) (((bfr)->m_flags & M_PKTHDR) != 0) @@ -407,10 +407,10 @@ (prev)->m_next = (new); \ } #define KB_UNLINKHEAD(head, next) { \ - MFREE((head), (next)); \ + (next) = m_free(head); \ } #define KB_UNLINK(old, prev, next) { \ - MFREE((old), (next)); \ + (next) = m_free(old); \ (prev)->m_next = (next); \ } #define KB_ISPKT(bfr) (0) Index: security/lomac/kernel_socket.c =================================================================== RCS file: /home/ncvs/src/sys/security/lomac/kernel_socket.c,v retrieving revision 1.3 diff -u -r1.3 kernel_socket.c --- security/lomac/kernel_socket.c 26 Dec 2001 18:31:22 -0000 1.3 +++ security/lomac/kernel_socket.c 6 Feb 2002 11:28:08 -0000 @@ -644,7 +644,7 @@ m = m->m_next; } else { sbfree(&so->so_rcv, m); - MFREE(m, so->so_rcv.sb_mb); + so->so_rcv.sb_mb = m_free(m); m = so->so_rcv.sb_mb; } } @@ -729,7 +729,7 @@ so->so_rcv.sb_mb = m = m->m_next; *mp = (struct mbuf *)0; } else { - MFREE(m, so->so_rcv.sb_mb); + so->so_rcv.sb_mb = m_free(m); m = so->so_rcv.sb_mb; } if (m) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message