summaryrefslogtreecommitdiff
path: root/sys/kern/uipc_mbuf.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2007-11-27 16:38:51 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2007-11-27 16:38:51 +0000
commit71abb69ad5b56f2815e077a3ef725973b5a7e280 (patch)
tree3d5dcb1b7c775d86a0454bf10df173e609b24678 /sys/kern/uipc_mbuf.c
parent661bb1dc316274e863790dc316fd698c664f4b92 (diff)
make the deceptively complicated leading and trailing space into functions.
this reduces kernel size quite a bit. ok claudio
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r--sys/kern/uipc_mbuf.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index c95648a262a..df1c2be80b1 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.86 2007/09/26 13:05:52 henning Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.87 2007/11/27 16:38:50 tedu Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -1037,3 +1037,23 @@ m_apply(struct mbuf *m, int off, int len,
return (0);
}
+
+int
+m_leadingspace(struct mbuf *m)
+{
+ if (M_READONLY((m)))
+ return 0;
+ return ((m)->m_flags & M_EXT ? (m)->m_data - (m)->m_ext.ext_buf :
+ (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat :
+ (m)->m_data - (m)->m_dat);
+}
+
+int
+m_trailingspace(struct mbuf *m)
+{
+ if (M_READONLY(m))
+ return 0;
+ return ((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf +
+ (m)->m_ext.ext_size - ((m)->m_data + (m)->m_len) :
+ &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len));
+}