summaryrefslogtreecommitdiff
path: root/sys/kern/uipc_mbuf.c
diff options
context:
space:
mode:
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));
+}