summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/include/comm
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-03-01 22:30:51 +0100
committerHarald Welte <laforge@gnumonks.org>2010-03-01 23:44:23 +0100
commit649793bf04f9289aca1d507909b072e2e0e36f58 (patch)
treefdcffef8e475ee9ca74ec20ed2ee6d436e8edbf4 /src/target/firmware/include/comm
parent5a1ef4361860c2c9dc986b134cd6f1037758ed2e (diff)
add msgb_l1() and msgb_l1len() inline functions
Diffstat (limited to 'src/target/firmware/include/comm')
-rw-r--r--src/target/firmware/include/comm/msgb.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/target/firmware/include/comm/msgb.h b/src/target/firmware/include/comm/msgb.h
index d9d518e8..a37bec56 100644
--- a/src/target/firmware/include/comm/msgb.h
+++ b/src/target/firmware/include/comm/msgb.h
@@ -45,9 +45,15 @@ extern void msgb_enqueue(struct llist_head *queue, struct msgb *msg);
extern struct msgb *msgb_dequeue(struct llist_head *queue);
extern void msgb_reset(struct msgb *m);
+#define msgb_l1(m) ((void *)(m->l1h))
#define msgb_l2(m) ((void *)(m->l2h))
#define msgb_l3(m) ((void *)(m->l3h))
+static inline unsigned int msgb_l1len(const struct msgb *msgb)
+{
+ return msgb->tail - (uint8_t *)msgb_l1(msgb);
+}
+
static inline unsigned int msgb_l2len(const struct msgb *msgb)
{
return msgb->tail - (uint8_t *)msgb_l2(msgb);