summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2010-09-20 20:33:19 +0000
committerShaun Ruffell <sruffell@digium.com>2010-09-20 20:33:19 +0000
commitdaeff161675aab3e42f0f3ce8a8fa6268c47a67c (patch)
treea552eca27a202309365e74645cd7b60feb5fa315
parent730d29156405019ec8243d2a5d2acf4c575705c6 (diff)
dahdi: Issue warning if DAHDI_INDIRECT ioctl is used.
DAHDI_INDIRECT is only used when setting up pciradio channels. dahdi_cfg no longer should need DAHDI_INDIRECT since revision 9352. Review: https://reviewboard.asterisk.org/r/905/ Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9365 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/dahdi-base.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index fd5fcae..1fa06d5 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -4410,15 +4410,39 @@ static int dahdi_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long da
void __user * const user_data = (void __user *)data;
int rv;
struct dahdi_span *s;
- switch(cmd) {
+ struct dahdi_chan *chan;
+
+ switch (cmd) {
case DAHDI_INDIRECT:
{
struct dahdi_indirect_data ind;
+ void *old;
+ static bool warned;
- if (copy_from_user(&ind, user_data, sizeof(ind)))
+ if (copy_from_user(&ind, (void __user *)data, sizeof(ind)))
return -EFAULT;
+
VALID_CHANNEL(ind.chan);
- return dahdi_chan_ioctl(file, ind.op, (unsigned long) ind.data, ind.chan);
+ chan = chans[ind.chan];
+ if (!chan)
+ return -EINVAL;
+
+ if (!warned) {
+ warned = true;
+ module_printk(KERN_WARNING, "Using deprecated " \
+ "DAHDI_INDIRECT. Please update " \
+ "dahdi-tools.\n");
+ }
+
+ /* Since dahdi_chan_ioctl expects to be called on file handles
+ * associated with channels, we'll temporarily set the
+ * private_data pointer on the ctl file handle just for this
+ * call. */
+ old = file->private_data;
+ file->private_data = chan;
+ res = dahdi_chan_ioctl(file, ind.op, (unsigned long) ind.data, ind.chan);
+ file->private_data = old;
+ return res;
}
case DAHDI_SPANCONFIG:
{