[zaptel-commits] tilghman: branch 1.4 r3048 - in /branches/1.4: zaptel-base.c zaptel.h

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Mon Sep 17 14:32:37 CDT 2007


Author: tilghman
Date: Mon Sep 17 14:32:36 2007
New Revision: 3048

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3048
Log:
Revert previous change on spaninfo and institute an ABI compatible call, to avoid breaking zaptel ABI compatibility between releases (closes issue #10745)

Modified:
    branches/1.4/zaptel-base.c
    branches/1.4/zaptel.h

Modified: branches/1.4/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel-base.c?view=diff&rev=3048&r1=3047&r2=3048
==============================================================================
--- branches/1.4/zaptel-base.c (original)
+++ branches/1.4/zaptel-base.c Mon Sep 17 14:32:36 2007
@@ -2952,6 +2952,7 @@
 	union {
 		struct zt_gains gain;
 		struct zt_spaninfo span;
+		struct zt_spaninfo_compat span_compat;
 		struct zt_params param;
 	} stack;
 	struct zt_chan *chan;
@@ -3137,8 +3138,9 @@
 		if (copy_to_user((struct zt_gains *) data,&stack.gain,sizeof(stack.gain)))
 			return -EFAULT;
 		break;
+	case ZT_SPANSTAT_COMPAT:
 	case ZT_SPANSTAT:
-		if (copy_from_user(&stack.span,(struct zt_spaninfo *) data,sizeof(stack.span)))
+		if (copy_from_user(&stack.span,(struct zt_spaninfo *) data, cmd == ZT_SPANSTAT_COMPAT ? sizeof(stack.span_compat) : sizeof(stack.span)))
 			return -EFAULT;
 		i = stack.span.spanno; /* get specified span number */
 		if ((i < 0) || (i >= maxspans)) return(-EINVAL);  /* if bad span no */
@@ -3165,13 +3167,14 @@
 		stack.span.irqmisses = spans[i]->irqmisses;	/* get IRQ miss count */
 		stack.span.syncsrc = spans[i]->syncsrc;	/* get active sync source */
 		stack.span.totalchans = spans[i]->channels;
+		/* We have space in the stack for these 2, even if they aren't copied back to userspace (for _COMPAT) */
 		stack.span.lbo = spans[i]->lbo;
 		stack.span.lineconfig = spans[i]->lineconfig;
 		stack.span.numchans = 0;
 		for (j=0; j < spans[i]->channels; j++)
 			if (spans[i]->chans[j].sig)
 				stack.span.numchans++;
-		if (copy_to_user((struct zt_spaninfo *) data,&stack.span,sizeof(stack.span)))
+		if (copy_to_user((struct zt_spaninfo *) data,&stack.span, cmd == ZT_SPANSTAT_COMPAT ? sizeof(stack.span_compat) : sizeof(stack.span)))
 			return -EFAULT;
 		break;
 #ifdef ALLOW_CHAN_DIAG

Modified: branches/1.4/zaptel.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel.h?view=diff&rev=3048&r1=3047&r2=3048
==============================================================================
--- branches/1.4/zaptel.h (original)
+++ branches/1.4/zaptel.h Mon Sep 17 14:32:36 2007
@@ -208,6 +208,25 @@
 int	pulseaftertime;
 } ZT_PARAMS;
 
+typedef struct zt_spaninfo_compat
+{
+int	spanno;		/* span number */
+char name[20];	/* Name of span */
+char desc[40];	/* Description of span */
+int	alarms;		/* alarms status */
+int	txlevel;	/* what TX level is set to */
+int	rxlevel;	/* current RX level */
+int	bpvcount;	/* current BPV count */
+int	crc4count;	/* current CRC4 error count */
+int	ebitcount;	/* current E-bit error count */
+int	fascount;	/* current FAS error count */
+int	irqmisses;	/* current IRQ misses */
+int	syncsrc;	/* span # of current sync source, or 0 for free run  */
+int	numchans;	/* number of configured channels on this span */
+int	totalchans;	/* total number of channels on the span */
+int	totalspans;	/* total number of zaptel spans in entire system */
+} ZT_SPANINFO_COMPAT;
+
 typedef struct zt_spaninfo
 {
 int	spanno;		/* span number */
@@ -389,8 +408,9 @@
 #define ZT_IOMUX		_IOWR (ZT_CODE, 9, int)
 
 /*
- * Get Span Status
- */
+ * Get Span Status (_COMPAT is deprecated)
+ */
+#define ZT_SPANSTAT_COMPAT		_IOWR (ZT_CODE, 10, struct zt_spaninfo_compat)
 #define ZT_SPANSTAT		_IOWR (ZT_CODE, 10, struct zt_spaninfo)
 
 /*




More information about the zaptel-commits mailing list