summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2010-10-20 12:23:16 +0000
committerShaun Ruffell <sruffell@digium.com>2010-10-20 12:23:16 +0000
commit43ac893528452c58be013ab18aeadfec4dcb1700 (patch)
treec8202f29bd507acced85d75375d9569a9d54281f /include
parentb873bb6011617a97f7e8978720719462fe14165b (diff)
dahdi: Atomically set/test if channel has associated network device.
Push all tests for the DAHDI_FLAGBIT_NETDEV flag behind a 'dahdi_have_netdev' function so if CONFIG_DAHDI_NET is not defined the compiler can just remove all the flag tests. Also, makes sure that the bit is checked / set atomically. (closes issue #9379) Signed-off-by: Shaun Ruffell <sruffell@digium.com> Acked-by: Kinsey Moore <kmoore@digium.com> Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9444 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'include')
-rw-r--r--include/dahdi/kernel.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
index 6edddbd..cf9ee3c 100644
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -692,7 +692,9 @@ enum {
DAHDI_FLAGBIT_MFDECODE = 3, /*!< Channel supports native MFr2 decode */
DAHDI_FLAGBIT_ECHOCANCEL= 4, /*!< Channel supports native echo cancellation */
DAHDI_FLAGBIT_HDLC = 5, /*!< Perform HDLC */
+#ifdef CONFIG_DAHDI_NET
DAHDI_FLAGBIT_NETDEV = 6, /*!< Send to network */
+#endif
DAHDI_FLAGBIT_CLEAR = 8, /*!< Clear channel */
DAHDI_FLAGBIT_AUDIO = 9, /*!< Audio mode channel */
DAHDI_FLAGBIT_OPEN = 10, /*!< Channel is open */
@@ -708,6 +710,20 @@ enum {
DAHDI_FLAGBIT_HDLC56 = 20, /*!< Sets the given channel (if in HDLC mode) to use 56K HDLC instead of 64K */
};
+#ifdef CONFIG_DAHDI_NET
+/**
+ * have_netdev() - Return true if a channel has an associated network device.
+ * @chan: Then channel to check.
+ *
+ */
+static inline int dahdi_have_netdev(const struct dahdi_chan *chan)
+{
+ return test_bit(DAHDI_FLAGBIT_NETDEV, &chan->flags);
+}
+#else
+static inline int dahdi_have_netdev(const struct dahdi_chan *chan) { return 0; }
+#endif
+
struct dahdi_count {
__u32 fe; /*!< Framing error counter */
__u32 cv; /*!< Coding violations counter */
@@ -740,7 +756,7 @@ struct dahdi_count {
#define DAHDI_FLAG_ECHOCANCEL DAHDI_FLAG(ECHOCANCEL)
#define DAHDI_FLAG_HDLC DAHDI_FLAG(HDLC)
-#define DAHDI_FLAG_NETDEV DAHDI_FLAG(NETDEV)
+/* #define DAHDI_FLAG_NETDEV DAHDI_FLAG(NETDEV) */
#define DAHDI_FLAG_CLEAR DAHDI_FLAG(CLEAR)
#define DAHDI_FLAG_AUDIO DAHDI_FLAG(AUDIO)