[dahdi-commits] sruffell: branch linux/sruffell/chan_list_refactoring r9306 - /linux/team/sru...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Mon Sep 6 10:04:35 CDT 2010


Author: sruffell
Date: Mon Sep  6 10:04:32 2010
New Revision: 9306

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9306
Log:
dahdi-squash: Issue warning if DAHDI_INDIRECT ioctl is used.

Allow DAHDI_INDIRECT to still function and issue warning if it is used.

Modified:
    linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c

Modified: linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c?view=diff&rev=9306&r1=9305&r2=9306
==============================================================================
--- linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c Mon Sep  6 10:04:32 2010
@@ -4461,11 +4461,32 @@
 	case DAHDI_INDIRECT:
 	{
 		struct dahdi_indirect_data ind;
-
-		if (copy_from_user(&ind, user_data, sizeof(ind)))
+		void *old;
+		static bool warned;
+
+		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 = chan_from_num(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);
+		file->private_data = old;
+		return res;
 	}
 	case DAHDI_SPANCONFIG:
 	{




More information about the dahdi-commits mailing list