Diff for /src/sys/kern/uipc_mbuf.c between versions 1.17 and 1.18

version 1.17, 2004/06/02 14:42:57 version 1.18, 2004/06/04 01:46:47
Line 31 Line 31
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.   * SUCH DAMAGE.
  *   *
 *        @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94 * @(#)uipc_mbuf.c        8.2 (Berkeley) 1/4/94
  * $FreeBSD: src/sys/kern/uipc_mbuf.c,v 1.51.2.24 2003/04/15 06:59:29 silby Exp $   * $FreeBSD: src/sys/kern/uipc_mbuf.c,v 1.51.2.24 2003/04/15 06:59:29 silby Exp $
  * $DragonFly$   * $DragonFly$
  */   */
Line 152  SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, Line 152  SYSINIT(tunable_mbinit, SI_SUB_TUNABLES,
   
 /* ARGSUSED*/  /* ARGSUSED*/
 static void  static void
mbinit(dummy)mbinit(void *dummy)
        void *dummy; 
 {  {
         int s;          int s;
   
Line 187  bad: Line 186  bad:
  */   */
 /* ARGSUSED */  /* ARGSUSED */
 int  int
m_mballoc(nmb, how)m_mballoc(int nmb, int how)
        int nmb; 
        int how; 
 {  {
         caddr_t p;          caddr_t p;
         int i;          int i;
Line 324  SYSINIT(mclallocthread, SI_SUB_KTHREAD_U Line 321  SYSINIT(mclallocthread, SI_SUB_KTHREAD_U
  */   */
 /* ARGSUSED */  /* ARGSUSED */
 int  int
m_clalloc(ncl, how)m_clalloc(int ncl, int how)
        int ncl; 
        int how; 
 {  {
         caddr_t p;          caddr_t p;
         int i;          int i;
Line 433  m_clalloc_wait(void) Line 428  m_clalloc_wait(void)
  * then re-attempt to allocate an mbuf.   * then re-attempt to allocate an mbuf.
  */   */
 struct mbuf *  struct mbuf *
m_retry(i, t)m_retry(int i, int t)
        int i, t; 
 {  {
         struct mbuf *m;          struct mbuf *m;
         int ms;          int ms;
Line 481  m_retry(i, t) Line 475  m_retry(i, t)
  * As above; retry an MGETHDR.   * As above; retry an MGETHDR.
  */   */
 struct mbuf *  struct mbuf *
m_retryhdr(i, t)m_retryhdr(int i, int t)
        int i, t; 
 {  {
         struct mbuf *m;          struct mbuf *m;
         int ms;          int ms;
Line 529  m_retryhdr(i, t) Line 522  m_retryhdr(i, t)
 }  }
   
 static void  static void
m_reclaim()m_reclaim(void)
 {  {
         struct domain *dp;          struct domain *dp;
         struct protosw *pr;          struct protosw *pr;
         int s = splimp();          int s = splimp();
   
        for (dp = domains; dp; dp = dp->dom_next)        for (dp = domains; dp; dp = dp->dom_next) {
                for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)                for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) {
                         if (pr->pr_drain)                          if (pr->pr_drain)
                                 (*pr->pr_drain)();                                  (*pr->pr_drain)();
                   }
           }
         splx(s);          splx(s);
         mbstat.m_drain++;          mbstat.m_drain++;
 }  }
Line 549  m_reclaim() Line 544  m_reclaim()
  * for critical paths.   * for critical paths.
  */   */
 struct mbuf *  struct mbuf *
m_get(how, type)m_get(int how, int type)
        int how, type; 
 {  {
         struct mbuf *m;          struct mbuf *m;
         int ms;          int ms;
Line 579  m_get(how, type) Line 573  m_get(how, type)
 }  }
   
 struct mbuf *  struct mbuf *
m_gethdr(how, type)m_gethdr(int how, int type)
        int how, type; 
 {  {
         struct mbuf *m;          struct mbuf *m;
         int ms;          int ms;
Line 612  m_gethdr(how, type) Line 605  m_gethdr(how, type)
 }  }
   
 struct mbuf *  struct mbuf *
m_getclr(how, type)m_getclr(int how, int type)
        int how, type; 
 {  {
         struct mbuf *m;          struct mbuf *m;
   
Line 889  m_freem(struct mbuf *m) Line 881  m_freem(struct mbuf *m)
  * copy junk along.   * copy junk along.
  */   */
 struct mbuf *  struct mbuf *
m_prepend(m, len, how)m_prepend(struct mbuf *m, int len, int how)
        struct mbuf *m; 
        int len, how; 
 {  {
         struct mbuf *mn;          struct mbuf *mn;
   
Line 920  m_prepend(m, len, how) Line 910  m_prepend(m, len, how)
 #define MCFail (mbstat.m_mcfail)  #define MCFail (mbstat.m_mcfail)
   
 struct mbuf *  struct mbuf *
m_copym(m, off0, len, wait)m_copym(const struct mbuf *m, int off0, int len, int wait)
        const struct mbuf *m; 
        int off0, wait; 
        int len; 
 {  {
         struct mbuf *n, **np;          struct mbuf *n, **np;
         int off = off0;          int off = off0;
Line 1005  nospace: Line 992  nospace:
  * the copies also have the room available.   * the copies also have the room available.
  */   */
 struct mbuf *  struct mbuf *
m_copypacket(m, how)m_copypacket(struct mbuf *m, int how)
        struct mbuf *m; 
        int how; 
 {  {
         struct mbuf *top, *n, *o;          struct mbuf *top, *n, *o;
   
Line 1079  nospace: Line 1064  nospace:
  * continuing for "len" bytes, into the indicated buffer.   * continuing for "len" bytes, into the indicated buffer.
  */   */
 void  void
m_copydata(m, off, len, cp)m_copydata(const struct mbuf *m, int off, int len, caddr_t cp)
        const struct mbuf *m; 
        int off; 
        int len; 
        caddr_t cp; 
 {  {
         unsigned count;          unsigned count;
   
Line 1113  m_copydata(m, off, len, cp) Line 1094  m_copydata(m, off, len, cp)
  * you need a writable copy of an mbuf chain.   * you need a writable copy of an mbuf chain.
  */   */
 struct mbuf *  struct mbuf *
m_dup(m, how)m_dup(struct mbuf *m, int how)
        struct mbuf *m; 
        int how; 
 {  {
         struct mbuf **p, *top = NULL;          struct mbuf **p, *top = NULL;
         int remain, moff, nsize;          int remain, moff, nsize;
Line 1188  nospace: Line 1167  nospace:
  * Any m_pkthdr is not updated.   * Any m_pkthdr is not updated.
  */   */
 void  void
m_cat(m, n)m_cat(struct mbuf *m, struct mbuf *n)
        struct mbuf *m, *n; 
 {  {
         while (m->m_next)          while (m->m_next)
                 m = m->m_next;                  m = m->m_next;
Line 1209  m_cat(m, n) Line 1187  m_cat(m, n)
 }  }
   
 void  void
m_adj(mp, req_len)m_adj(struct mbuf *mp, int req_len)
        struct mbuf *mp; 
        int req_len; 
 {  {
         int len = req_len;          int len = req_len;
         struct mbuf *m;          struct mbuf *m;
Line 1293  m_adj(mp, req_len) Line 1269  m_adj(mp, req_len)
 #define MPFail (mbstat.m_mpfail)  #define MPFail (mbstat.m_mpfail)
   
 struct mbuf *  struct mbuf *
m_pullup(n, len)m_pullup(struct mbuf *n, int len)
        struct mbuf *n; 
        int len; 
 {  {
         struct mbuf *m;          struct mbuf *m;
         int count;          int count;
Line 1360  bad: Line 1334  bad:
  * M_WRITABLE() macro to check for this case.   * M_WRITABLE() macro to check for this case.
  */   */
 struct mbuf *  struct mbuf *
m_split(m0, len0, wait)m_split(struct mbuf *m0, int len0, int wait)
        struct mbuf *m0; 
        int len0, wait; 
 {  {
         struct mbuf *m, *n;          struct mbuf *m, *n;
         unsigned len = len0, remain;          unsigned len = len0, remain;
Line 1431  extpacket: Line 1403  extpacket:
  * Routine to copy from device local memory into mbufs.   * Routine to copy from device local memory into mbufs.
  */   */
 struct mbuf *  struct mbuf *
m_devget(buf, totlen, off0, ifp, copy)m_devget(char *buf, int totlen, int off0, struct ifnet *ifp, 
        char *buf;        void (*copy) (char *from, caddr_t to, u_int len))
        int totlen, off0; 
        struct ifnet *ifp; 
        void (*copy) (char *from, caddr_t to, u_int len); 
 {  {
         struct mbuf *m;          struct mbuf *m;
         struct mbuf *top = 0, **mp = &top;          struct mbuf *top = 0, **mp = &top;
Line 1503  m_devget(buf, totlen, off0, ifp, copy) Line 1472  m_devget(buf, totlen, off0, ifp, copy)
  * chain if necessary.   * chain if necessary.
  */   */
 void  void
m_copyback(m0, off, len, cp)m_copyback(struct mbuf *m0, int off, int len, caddr_t cp)
        struct  mbuf *m0; 
        int off; 
        int len; 
        caddr_t cp; 
 {  {
         int mlen;          int mlen;
         struct mbuf *m = m0, *n;          struct mbuf *m = m0, *n;

Removed from v.1.17  
changed lines
  Added in v.1.18