From fa1d3ba9465064f7a1551fe7369525d8b355861d Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Wed, 23 May 2012 12:20:23 +0000 Subject: convert span->spantype to enumerated type * This is a minimal convertion -- everything compiles and looks OK. * We print a warning for spans registering without a spantype. * Low-level drivers may later want (but not required) to fold their internal representations to this canonical representation -- it will save code and make it more readable. Signed-off-by: Shaun Ruffell Acked-by: Tzafrir Cohen git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10683 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- include/dahdi/kernel.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index 9922f11..d1f8631 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -792,6 +792,21 @@ struct dahdi_count { #define DAHDI_FLAG_TXUNDERRUN DAHDI_FLAG(TXUNDERRUN) #define DAHDI_FLAG_RXOVERRUN DAHDI_FLAG(RXOVERRUN) +enum spantypes { + SPANTYPE_INVALID = 0, + SPANTYPE_ANALOG_FXS, + SPANTYPE_ANALOG_FXO, + SPANTYPE_ANALOG_MIXED, + SPANTYPE_DIGITAL_E1, + SPANTYPE_DIGITAL_T1, + SPANTYPE_DIGITAL_J1, + SPANTYPE_DIGITAL_BRI_NT, + SPANTYPE_DIGITAL_BRI_TE, + SPANTYPE_DIGITAL_BRI_SOFT, +}; +const char *dahdi_spantype2str(enum spantypes st); +enum spantypes dahdi_str2spantype(const char *name); + struct file; struct dahdi_span_ops { @@ -890,7 +905,7 @@ struct dahdi_span_ops { /*! Called when the spantype / linemode is changed before the span is * assigned a number. */ - int (*set_spantype)(struct dahdi_span *span, const char *spantype); + int (*set_spantype)(struct dahdi_span *span, enum spantypes st); }; /** @@ -921,7 +936,7 @@ struct dahdi_span { spinlock_t lock; char name[40]; /*!< Span name */ char desc[80]; /*!< Span description */ - const char *spantype; /*!< span type in text form */ + enum spantypes spantype; /*!< span type */ int deflaw; /*!< Default law (DAHDI_MULAW or DAHDI_ALAW) */ int alarms; /*!< Pending alarms on span */ unsigned long flags; -- cgit v1.2.3