return types, add a comment or type where necessary.
authorChris G. Demetriou <cgd@ucbvax.Berkeley.EDU>
Wed, 15 Feb 1995 02:48:25 +0000 (18:48 -0800)
committerChris G. Demetriou <cgd@ucbvax.Berkeley.EDU>
Wed, 15 Feb 1995 02:48:25 +0000 (18:48 -0800)
SCCS-vsn: sys/kern/uipc_mbuf.c 8.4

usr/src/sys/kern/uipc_mbuf.c

index faf82a2..ee89d3b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)uipc_mbuf.c 8.3 (Berkeley) %G%
+ *     @(#)uipc_mbuf.c 8.4 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -25,17 +25,13 @@ extern      vm_map_t mb_map;
 struct mbuf *mbutl;
 char   *mclrefcnt;
 
 struct mbuf *mbutl;
 char   *mclrefcnt;
 
+void
 mbinit()
 {
        int s;
 
 mbinit()
 {
        int s;
 
-#if CLBYTES < 4096
-#define NCL_INIT       (4096/CLBYTES)
-#else
-#define NCL_INIT       1
-#endif
        s = splimp();
        s = splimp();
-       if (m_clalloc(NCL_INIT, M_DONTWAIT) == 0)
+       if (m_clalloc(max(4096/CLBYTES, 1), M_DONTWAIT) == 0)
                goto bad;
        splx(s);
        return;
                goto bad;
        splx(s);
        return;
@@ -49,6 +45,7 @@ bad:
  * Must be called at splimp.
  */
 /* ARGSUSED */
  * Must be called at splimp.
  */
 /* ARGSUSED */
+int
 m_clalloc(ncl, nowait)
        register int ncl;
        int nowait;
 m_clalloc(ncl, nowait)
        register int ncl;
        int nowait;
@@ -111,6 +108,7 @@ m_retryhdr(i, t)
        return (m);
 }
 
        return (m);
 }
 
+void
 m_reclaim()
 {
        register struct domain *dp;
 m_reclaim()
 {
        register struct domain *dp;
@@ -297,6 +295,7 @@ nospace:
  * Copy data from an mbuf chain starting "off" bytes from the beginning,
  * continuing for "len" bytes, into the indicated buffer.
  */
  * Copy data from an mbuf chain starting "off" bytes from the beginning,
  * continuing for "len" bytes, into the indicated buffer.
  */
+void
 m_copydata(m, off, len, cp)
        register struct mbuf *m;
        register int off;
 m_copydata(m, off, len, cp)
        register struct mbuf *m;
        register int off;
@@ -332,6 +331,7 @@ m_copydata(m, off, len, cp)
  * Both chains must be of the same type (e.g. MT_DATA).
  * Any m_pkthdr is not updated.
  */
  * Both chains must be of the same type (e.g. MT_DATA).
  * Any m_pkthdr is not updated.
  */
+void
 m_cat(m, n)
        register struct mbuf *m, *n;
 {
 m_cat(m, n)
        register struct mbuf *m, *n;
 {
@@ -578,8 +578,12 @@ m_devget(buf, totlen, off0, ifp, copy)
        cp = buf;
        epkt = cp + totlen;
        if (off) {
        cp = buf;
        epkt = cp + totlen;
        if (off) {
-               cp += off + 2 * sizeof(u_short);
-               totlen -= 2 * sizeof(u_short);
+               /*
+                * If 'off' is non-zero, packet is trailer-encapsulated,
+                * so we have to skip the type and length fields.
+                */
+               cp += off + 2 * sizeof(u_int16_t);
+               totlen -= 2 * sizeof(u_int16_t);
        }
        MGETHDR(m, M_DONTWAIT, MT_DATA);
        if (m == 0)
        }
        MGETHDR(m, M_DONTWAIT, MT_DATA);
        if (m == 0)