diff options
author | tilghman <tilghman@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-09-17 19:32:36 +0000 |
---|---|---|
committer | tilghman <tilghman@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-09-17 19:32:36 +0000 |
commit | 804924cca39b266e754dcd58dd4d094dbe09e843 (patch) | |
tree | d58029daf6a75017e879f87d53c5c9a51d5a3069 | |
parent | ecc65d80b45261573e0ee298de60da0ecb41fa28 (diff) |
Revert previous change on spaninfo and institute an ABI compatible call, to avoid breaking zaptel ABI compatibility between releases (closes issue #10745)
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3048 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r-- | zaptel-base.c | 7 | ||||
-rw-r--r-- | zaptel.h | 22 |
2 files changed, 26 insertions, 3 deletions
diff --git a/zaptel-base.c b/zaptel-base.c index 643bdf9..20dcfaf 100644 --- a/zaptel-base.c +++ b/zaptel-base.c @@ -2952,6 +2952,7 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c 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 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c 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 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c 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 @@ -208,6 +208,25 @@ int pulsemaketime; 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 @@ struct zt_versioninfo { #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) /* |