summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/uipc_mbuf.c30
-rw-r--r--sys/sys/malloc.h4
-rw-r--r--sys/sys/mbuf.h29
3 files changed, 56 insertions, 7 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 7b4801f9d53..6ca1e718531 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.27 2001/05/05 20:57:00 art Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.28 2001/05/16 08:59:04 art Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -1029,3 +1029,31 @@ m_apply(m, off, len, f, fstate)
return (0);
}
+
+#ifdef SMALL_KERNEL
+/*
+ * The idea of adding code in a small kernel might look absurd, but this is
+ * instead of macros.
+ */
+struct mbuf *
+_sk_mget(int how, int type)
+{
+ struct mbuf *m;
+ _MGET(m, how, type);
+ return m;
+}
+
+struct mbuf *
+_sk_mgethdr(int how, int type)
+{
+ struct mbuf *m;
+ _MGETHDR(m, how, type);
+ return m;
+}
+
+void
+_sk_mclget(struct mbuf *m, int how)
+{
+ _MCLGET(m, how);
+}
+#endif /* SMALL_KERNEL */ \ No newline at end of file
diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h
index ed2fba8a408..1acafe924ea 100644
--- a/sys/sys/malloc.h
+++ b/sys/sys/malloc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: malloc.h,v 1.42 2001/05/14 08:02:21 angelos Exp $ */
+/* $OpenBSD: malloc.h,v 1.43 2001/05/16 08:59:03 art Exp $ */
/* $NetBSD: malloc.h,v 1.39 1998/07/12 19:52:01 augustss Exp $ */
/*
@@ -387,7 +387,7 @@ struct kmembuckets {
/*
* Macro versions for the usual cases of malloc/free
*/
-#if defined(KMEMSTATS) || defined(DIAGNOSTIC) || defined(_LKM)
+#if defined(KMEMSTATS) || defined(DIAGNOSTIC) || defined(_LKM) || defined(SMALL_KERNEL)
#define MALLOC(space, cast, size, type, flags) \
(space) = (cast)malloc((u_long)(size), type, flags)
#define FREE(addr, type) free((caddr_t)(addr), type)
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index d0dba6fbf75..9a2f8c04d32 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbuf.h,v 1.23 2001/05/15 22:02:07 deraadt Exp $ */
+/* $OpenBSD: mbuf.h,v 1.24 2001/05/16 08:59:04 art Exp $ */
/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */
/*
@@ -194,7 +194,7 @@ struct mbuf {
* allocates an mbuf and initializes it to contain a packet header
* and internal data.
*/
-#define MGET(m, how, type) { \
+#define _MGET(m, how, type) { \
MALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \
if (m) { \
(m)->m_type = (type); \
@@ -207,7 +207,14 @@ struct mbuf {
(m) = m_retry((how), (type)); \
}
-#define MGETHDR(m, how, type) { \
+#ifdef SMALL_KERNEL
+struct mbuf *_sk_mget(int, int);
+#define MGET(m, how, type) { m = _sk_mget(how, type); }
+#else
+#define MGET(m, how, type) _MGET(m, how, type)
+#endif
+
+#define _MGETHDR(m, how, type) { \
MALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \
if (m) { \
(m)->m_type = (type); \
@@ -221,6 +228,13 @@ struct mbuf {
(m) = m_retryhdr((how), (type)); \
}
+#ifdef SMALL_KERNEL
+struct mbuf *_sk_mgethdr(int, int);
+#define MGETHDR(m, how, type) { m = _sk_mgethdr(how, type); }
+#else
+#define MGETHDR(m, how, type) _MGETHDR(m, how, type)
+#endif
+
/*
* Mbuf cluster macros.
* MCLALLOC(caddr_t p, int how) allocates an mbuf cluster.
@@ -249,7 +263,7 @@ union mcluster {
} \
)
-#define MCLGET(m, how) \
+#define _MCLGET(m, how) \
{ MCLALLOC((m)->m_ext.ext_buf, (how)); \
if ((m)->m_ext.ext_buf != NULL) { \
(m)->m_data = (m)->m_ext.ext_buf; \
@@ -261,6 +275,13 @@ union mcluster {
} \
}
+#ifdef SMALL_KERNEL
+void _sk_mclget(struct mbuf *, int);
+#define MCLGET(m, how) _sk_mclget(m, how)
+#else
+#define MCLGET(m, how) _MCLGET(m, how)
+#endif
+
#define MCLFREE(p) \
MBUFLOCK ( \
if (--mclrefcnt[mtocl(p)] == 0) { \