aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/sockbuf.h
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2014-11-30 11:02:07 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2014-11-30 11:02:07 +0000
commit8967b220a3ec4e089ca18321bb9f35fb72407828 (patch)
tree268d032156dee2f7123f3deddf60dca8a0c5cab9 /sys/sys/sockbuf.h
parent6e52f863eef5dbdcc93feee4f8f2b41a01443a95 (diff)
downloadsrc-8967b220a3ec4e089ca18321bb9f35fb72407828.tar.gz
src-8967b220a3ec4e089ca18321bb9f35fb72407828.zip
Make sballoc() and sbfree() functions. Ideally, they could be marked
as static, but unfortunately Infiniband (ab)uses them. Sponsored by: Nginx, Inc.
Notes
Notes: svn path=/head/; revision=275312
Diffstat (limited to 'sys/sys/sockbuf.h')
-rw-r--r--sys/sys/sockbuf.h34
1 files changed, 2 insertions, 32 deletions
diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h
index f9e8da4cde0b..ae06ac6cb0db 100644
--- a/sys/sys/sockbuf.h
+++ b/sys/sys/sockbuf.h
@@ -164,6 +164,8 @@ void sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb);
int sbwait(struct sockbuf *sb);
int sblock(struct sockbuf *sb, int flags);
void sbunlock(struct sockbuf *sb);
+void sballoc(struct sockbuf *, struct mbuf *);
+void sbfree(struct sockbuf *, struct mbuf *);
/*
* Return how much data is available to be taken out of socket
@@ -213,38 +215,6 @@ sbspace(struct sockbuf *sb)
return((bleft < mleft) ? bleft : mleft);
}
-/* adjust counters in sb reflecting allocation of m */
-#define sballoc(sb, m) { \
- (sb)->sb_cc += (m)->m_len; \
- if ((m)->m_type != MT_DATA && (m)->m_type != MT_OOBDATA) \
- (sb)->sb_ctl += (m)->m_len; \
- (sb)->sb_mbcnt += MSIZE; \
- (sb)->sb_mcnt += 1; \
- if ((m)->m_flags & M_EXT) { \
- (sb)->sb_mbcnt += (m)->m_ext.ext_size; \
- (sb)->sb_ccnt += 1; \
- } \
-}
-
-/* adjust counters in sb reflecting freeing of m */
-#define sbfree(sb, m) { \
- (sb)->sb_cc -= (m)->m_len; \
- if ((m)->m_type != MT_DATA && (m)->m_type != MT_OOBDATA) \
- (sb)->sb_ctl -= (m)->m_len; \
- (sb)->sb_mbcnt -= MSIZE; \
- (sb)->sb_mcnt -= 1; \
- if ((m)->m_flags & M_EXT) { \
- (sb)->sb_mbcnt -= (m)->m_ext.ext_size; \
- (sb)->sb_ccnt -= 1; \
- } \
- if ((sb)->sb_sndptr == (m)) { \
- (sb)->sb_sndptr = NULL; \
- (sb)->sb_sndptroff = 0; \
- } \
- if ((sb)->sb_sndptroff != 0) \
- (sb)->sb_sndptroff -= (m)->m_len; \
-}
-
#define SB_EMPTY_FIXUP(sb) do { \
if ((sb)->sb_mb == NULL) { \
(sb)->sb_mbtail = NULL; \