summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>1999-12-14 02:23:14 +0000
committergreen <green@FreeBSD.org>1999-12-14 02:23:14 +0000
commit92bdda92f42925230e9bc724b4786896f2755e88 (patch)
treef85698ceaf0663a3e1f5f68630e1c29ddab3ce6b /sys
parent003a13cc327a75a9c8505597dd8fe28a28152325 (diff)
downloadFreeBSD-src-92bdda92f42925230e9bc724b4786896f2755e88.zip
FreeBSD-src-92bdda92f42925230e9bc724b4786896f2755e88.tar.gz
Bug fix:
The variables "m_mclalloc_wid" and "m_mballoc_wid" were not in the proper place. They should have been in uipc_mbuf.c and have been global, not in mbuf.h and local per each file that uses mbuf.h. Sorta bug fix: In mbuf.h, the definitions of various things for KERNEL and not KERNEL cases were very screwy. This fixes all of that which I could find.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/uipc_mbuf.c2
-rw-r--r--sys/sys/mbuf.h78
2 files changed, 38 insertions, 42 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 9650c68..d648f5c 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -66,6 +66,8 @@ int max_hdr;
int max_datalen;
int nmbclusters;
int nmbufs;
+u_int m_mballoc_wid = 0;
+u_int m_clalloc_wid = 0;
SYSCTL_DECL(_kern_ipc);
SYSCTL_INT(_kern_ipc, KIPC_MAX_LINKHDR, max_linkhdr, CTLFLAG_RW,
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index b4f5396..9bfc324 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -153,27 +153,34 @@ struct mbuf {
#define MT_CONTROL 14 /* extra-data protocol message */
#define MT_OOBDATA 15 /* expedited data */
-/* flags to m_get/MGET */
-#define M_DONTWAIT 1
-#define M_WAIT 0
-
-/* mbuf and mbuf cluster wait count variables... */
-static u_int m_mballoc_wid = 0, m_clalloc_wid = 0;
+/*
+ * Mbuf statistics.
+ */
+struct mbstat {
+ u_long m_mbufs; /* mbufs obtained from page pool */
+ u_long m_clusters; /* clusters obtained from page pool */
+ u_long m_spare; /* spare field */
+ u_long m_clfree; /* free clusters */
+ u_long m_drops; /* times failed to find space */
+ u_long m_wait; /* times waited for space */
+ u_long m_drain; /* times drained protocols for space */
+ u_short m_mtypes[256]; /* type specific mbuf allocations */
+ u_long m_mcfail; /* times m_copym failed */
+ u_long m_mpfail; /* times m_pullup failed */
+ u_long m_msize; /* length of an mbuf */
+ u_long m_mclbytes; /* length of an mbuf cluster */
+ u_long m_minclsize; /* min length of data to allocate a cluster */
+ u_long m_mlen; /* length of data in an mbuf */
+ u_long m_mhlen; /* length of data in a header mbuf */
+};
-static __inline void m_mballoc_wakeup __P((void));
-static __inline void m_clalloc_wakeup __P((void));
-/* We'll need wakeup_one(). */
#ifdef KERNEL
+/* We'll need wakeup_one(). */
#include <sys/systm.h>
-#endif
-/*
- * Identifying number passed to the m_mballoc_wait function, allowing
- * us to determine that the call came from an MGETHDR and not an MGET --
- * this way we are sure to run the MGETHDR macro when the call came from there.
- */
-#define MGETHDR_C 1
-#define MGET_C 2
+/* flags to m_get/MGET */
+#define M_DONTWAIT 1
+#define M_WAIT 0
/* Freelists:
*
@@ -186,9 +193,18 @@ union mcluster {
char mcl_buf[MCLBYTES];
};
+/* mbuf and mbuf cluster wait count variables */
+extern u_int m_mballoc_wid;
+extern u_int m_clalloc_wid;
+
/*
- * mbuf and mbuf cluster wakeup inline routines.
+ * Identifying number passed to the m_mballoc_wait function, allowing
+ * us to determine that the call came from an MGETHDR and not an MGET --
+ * this way we are sure to run the MGETHDR macro when the call came from there.
*/
+#define MGETHDR_C 1
+#define MGET_C 2
+
/*
* Wakeup the next instance -- if any -- of m_mballoc_wait() which
* is waiting for an mbuf to be freed. Make sure to decrement sleep count.
@@ -439,28 +455,6 @@ m_clalloc_wakeup(void)
/* compatibility with 4.3 */
#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT)
-/*
- * Mbuf statistics.
- */
-struct mbstat {
- u_long m_mbufs; /* mbufs obtained from page pool */
- u_long m_clusters; /* clusters obtained from page pool */
- u_long m_spare; /* spare field */
- u_long m_clfree; /* free clusters */
- u_long m_drops; /* times failed to find space */
- u_long m_wait; /* times waited for space */
- u_long m_drain; /* times drained protocols for space */
- u_short m_mtypes[256]; /* type specific mbuf allocations */
- u_long m_mcfail; /* times m_copym failed */
- u_long m_mpfail; /* times m_pullup failed */
- u_long m_msize; /* length of an mbuf */
- u_long m_mclbytes; /* length of an mbuf cluster */
- u_long m_minclsize; /* min length of data to allocate a cluster */
- u_long m_mlen; /* length of data in an mbuf */
- u_long m_mhlen; /* length of data in a header mbuf */
-};
-
-#ifdef KERNEL
extern struct mbuf *mbutl; /* virtual address of mclusters */
extern char *mclrefcnt; /* cluster reference counts */
extern struct mbstat mbstat;
@@ -475,7 +469,7 @@ extern int max_hdr; /* largest link+protocol header */
extern int max_datalen; /* MHLEN - max_hdr */
extern int mbuf_wait; /* mbuf sleep time */
-struct mbuf *m_mballoc_wait __P((int, int));
+struct mbuf *m_mballoc_wait __P((int, int));
struct mbuf *m_copym __P((struct mbuf *, int, int, int));
struct mbuf *m_copypacket __P((struct mbuf *, int));
struct mbuf *m_devget __P((char *, int, int, struct ifnet *,
@@ -495,7 +489,7 @@ void m_adj __P((struct mbuf *, int));
void m_cat __P((struct mbuf *,struct mbuf *));
int m_mballoc __P((int, int));
int m_clalloc __P((int, int));
-caddr_t m_clalloc_wait __P((void));
+caddr_t m_clalloc_wait __P((void));
void m_copyback __P((struct mbuf *, int, int, caddr_t));
void m_copydata __P((struct mbuf *,int,int,caddr_t));
void m_freem __P((struct mbuf *));
OpenPOWER on IntegriCloud