aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2006-01-03 17:18:33 -0500
committerDavid S. Miller <davem@davemloft.net>2006-01-03 17:18:33 -0500
commitb5e5fa5e093e42cab4ee3d6dcbc4f450ad29a723 (patch)
tree7a87804b0953f22de43054ccc7ae67ebc5b66b20 /net
parent5ff7630e4aa6c3969094dc30ff1cdaa6f52b0ed0 (diff)
[NET]: Add a dev_ioctl() fallback to sock_ioctl()
Currently all network protocols need to call dev_ioctl as the default fallback in their ioctl implementations. This patch adds a fallback to dev_ioctl to sock_ioctl if the protocol returned -ENOIOCTLCMD. This way all the procotol ioctl handlers can be simplified and we don't need to export dev_ioctl. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/appletalk/ddp.c19
-rw-r--r--net/ax25/af_ax25.c2
-rw-r--r--net/core/dev.c1
-rw-r--r--net/decnet/af_decnet.c2
-rw-r--r--net/econet/af_econet.c2
-rw-r--r--net/ipv4/af_inet.c8
-rw-r--r--net/ipv6/af_inet6.c8
-rw-r--r--net/ipx/af_ipx.c2
-rw-r--r--net/irda/af_irda.c2
-rw-r--r--net/llc/af_llc.c2
-rw-r--r--net/netrom/af_netrom.c2
-rw-r--r--net/packet/af_packet.c2
-rw-r--r--net/rose/af_rose.c2
-rw-r--r--net/socket.c7
-rw-r--r--net/unix/af_unix.c2
-rw-r--r--net/wanrouter/af_wanpipe.c2
-rw-r--r--net/x25/af_x25.c2
17 files changed, 27 insertions, 40 deletions
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 296f186802ff..a5144e43aae1 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1763,7 +1763,7 @@ static int atalk_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
1763 */ 1763 */
1764static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) 1764static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1765{ 1765{
1766 int rc = -EINVAL; 1766 int rc = -ENOIOCTLCMD;
1767 struct sock *sk = sock->sk; 1767 struct sock *sk = sock->sk;
1768 void __user *argp = (void __user *)arg; 1768 void __user *argp = (void __user *)arg;
1769 1769
@@ -1813,23 +1813,6 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1813 rc = atif_ioctl(cmd, argp); 1813 rc = atif_ioctl(cmd, argp);
1814 rtnl_unlock(); 1814 rtnl_unlock();
1815 break; 1815 break;
1816 /* Physical layer ioctl calls */
1817 case SIOCSIFLINK:
1818 case SIOCGIFHWADDR:
1819 case SIOCSIFHWADDR:
1820 case SIOCGIFFLAGS:
1821 case SIOCSIFFLAGS:
1822 case SIOCGIFTXQLEN:
1823 case SIOCSIFTXQLEN:
1824 case SIOCGIFMTU:
1825 case SIOCGIFCONF:
1826 case SIOCADDMULTI:
1827 case SIOCDELMULTI:
1828 case SIOCGIFCOUNT:
1829 case SIOCGIFINDEX:
1830 case SIOCGIFNAME:
1831 rc = dev_ioctl(cmd, argp);
1832 break;
1833 } 1816 }
1834 1817
1835 return rc; 1818 return rc;
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 8b5d10aaba05..e8753c7fcad1 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1827,7 +1827,7 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1827 break; 1827 break;
1828 1828
1829 default: 1829 default:
1830 res = dev_ioctl(cmd, argp); 1830 res = -ENOIOCTLCMD;
1831 break; 1831 break;
1832 } 1832 }
1833 release_sock(sk); 1833 release_sock(sk);
diff --git a/net/core/dev.c b/net/core/dev.c
index a5efc9ae010b..29ba109d3e54 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3276,7 +3276,6 @@ EXPORT_SYMBOL(dev_close);
3276EXPORT_SYMBOL(dev_get_by_flags); 3276EXPORT_SYMBOL(dev_get_by_flags);
3277EXPORT_SYMBOL(dev_get_by_index); 3277EXPORT_SYMBOL(dev_get_by_index);
3278EXPORT_SYMBOL(dev_get_by_name); 3278EXPORT_SYMBOL(dev_get_by_name);
3279EXPORT_SYMBOL(dev_ioctl);
3280EXPORT_SYMBOL(dev_open); 3279EXPORT_SYMBOL(dev_open);
3281EXPORT_SYMBOL(dev_queue_xmit); 3280EXPORT_SYMBOL(dev_queue_xmit);
3282EXPORT_SYMBOL(dev_remove_pack); 3281EXPORT_SYMBOL(dev_remove_pack);
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 65e3baed0251..78ec5344be86 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -1252,7 +1252,7 @@ static int dn_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1252 break; 1252 break;
1253 1253
1254 default: 1254 default:
1255 err = dev_ioctl(cmd, (void __user *)arg); 1255 err = -ENOIOCTLCMD;
1256 break; 1256 break;
1257 } 1257 }
1258 1258
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 70fb2b88da65..4fc245243cca 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -687,7 +687,7 @@ static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg
687 break; 687 break;
688 688
689 default: 689 default:
690 return dev_ioctl(cmd, argp); 690 return -ENOIOCTLCMD;
691 } 691 }
692 /*NOTREACHED*/ 692 /*NOTREACHED*/
693 return 0; 693 return 0;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 36a6306ca5a3..966a071a408c 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -777,10 +777,10 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
777 err = devinet_ioctl(cmd, (void __user *)arg); 777 err = devinet_ioctl(cmd, (void __user *)arg);
778 break; 778 break;
779 default: 779 default:
780 if (!sk->sk_prot->ioctl || 780 if (sk->sk_prot->ioctl)
781 (err = sk->sk_prot->ioctl(sk, cmd, arg)) == 781 err = sk->sk_prot->ioctl(sk, cmd, arg);
782 -ENOIOCTLCMD) 782 else
783 err = dev_ioctl(cmd, (void __user *)arg); 783 err = -ENOIOCTLCMD;
784 break; 784 break;
785 } 785 }
786 return err; 786 return err;
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 7c9f19269f21..68afc53be662 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -434,7 +434,6 @@ int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
434int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) 434int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
435{ 435{
436 struct sock *sk = sock->sk; 436 struct sock *sk = sock->sk;
437 int err = -EINVAL;
438 437
439 switch(cmd) 438 switch(cmd)
440 { 439 {
@@ -453,10 +452,9 @@ int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
453 case SIOCSIFDSTADDR: 452 case SIOCSIFDSTADDR:
454 return addrconf_set_dstaddr((void __user *) arg); 453 return addrconf_set_dstaddr((void __user *) arg);
455 default: 454 default:
456 if (!sk->sk_prot->ioctl || 455 if (!sk->sk_prot->ioctl)
457 (err = sk->sk_prot->ioctl(sk, cmd, arg)) == -ENOIOCTLCMD) 456 return -ENOIOCTLCMD;
458 return(dev_ioctl(cmd,(void __user *) arg)); 457 return sk->sk_prot->ioctl(sk, cmd, arg);
459 return err;
460 } 458 }
461 /*NOTREACHED*/ 459 /*NOTREACHED*/
462 return(0); 460 return(0);
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 6c464c11bb09..0dc519b40404 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -1884,7 +1884,7 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1884 rc = -EINVAL; 1884 rc = -EINVAL;
1885 break; 1885 break;
1886 default: 1886 default:
1887 rc = dev_ioctl(cmd, argp); 1887 rc = -ENOIOCTLCMD;
1888 break; 1888 break;
1889 } 1889 }
1890 1890
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index e57683d424f7..fbfa96754417 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -1822,7 +1822,7 @@ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1822 return -EINVAL; 1822 return -EINVAL;
1823 default: 1823 default:
1824 IRDA_DEBUG(1, "%s(), doing device ioctl!\n", __FUNCTION__); 1824 IRDA_DEBUG(1, "%s(), doing device ioctl!\n", __FUNCTION__);
1825 return dev_ioctl(cmd, (void __user *) arg); 1825 return -ENOIOCTLCMD;
1826 } 1826 }
1827 1827
1828 /*NOTREACHED*/ 1828 /*NOTREACHED*/
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 9cf65f9d8902..8171c53bc0ed 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -959,7 +959,7 @@ out:
959static int llc_ui_ioctl(struct socket *sock, unsigned int cmd, 959static int llc_ui_ioctl(struct socket *sock, unsigned int cmd,
960 unsigned long arg) 960 unsigned long arg)
961{ 961{
962 return dev_ioctl(cmd, (void __user *)arg); 962 return -ENOIOCTLCMD;
963} 963}
964 964
965/** 965/**
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 9ee672e19ec1..63b0e4afeb33 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -1215,7 +1215,7 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1215 return nr_rt_ioctl(cmd, argp); 1215 return nr_rt_ioctl(cmd, argp);
1216 1216
1217 default: 1217 default:
1218 return dev_ioctl(cmd, argp); 1218 return -ENOIOCTLCMD;
1219 } 1219 }
1220 1220
1221 return 0; 1221 return 0;
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index deda6fdb1e53..f69e5ed9bd06 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1521,7 +1521,7 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
1521#endif 1521#endif
1522 1522
1523 default: 1523 default:
1524 return dev_ioctl(cmd, (void __user *)arg); 1524 return -ENOIOCTLCMD;
1525 } 1525 }
1526 return 0; 1526 return 0;
1527} 1527}
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 829fdbc4400b..63090be2315a 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -1320,7 +1320,7 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1320 return 0; 1320 return 0;
1321 1321
1322 default: 1322 default:
1323 return dev_ioctl(cmd, argp); 1323 return -ENOIOCTLCMD;
1324 } 1324 }
1325 1325
1326 return 0; 1326 return 0;
diff --git a/net/socket.c b/net/socket.c
index 0dde6dade2b1..06fa217f58a9 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -900,6 +900,13 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg)
900 break; 900 break;
901 default: 901 default:
902 err = sock->ops->ioctl(sock, cmd, arg); 902 err = sock->ops->ioctl(sock, cmd, arg);
903
904 /*
905 * If this ioctl is unknown try to hand it down
906 * to the NIC driver.
907 */
908 if (err == -ENOIOCTLCMD)
909 err = dev_ioctl(cmd, argp);
903 break; 910 break;
904 } 911 }
905 return err; 912 return err;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 1ddd36d50091..5f6ae79b8b16 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1859,7 +1859,7 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1859 } 1859 }
1860 1860
1861 default: 1861 default:
1862 err = dev_ioctl(cmd, (void __user *)arg); 1862 err = -ENOIOCTLCMD;
1863 break; 1863 break;
1864 } 1864 }
1865 return err; 1865 return err;
diff --git a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c
index 67948bf22dc4..7a43ae4721ed 100644
--- a/net/wanrouter/af_wanpipe.c
+++ b/net/wanrouter/af_wanpipe.c
@@ -1839,7 +1839,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar
1839#endif 1839#endif
1840 1840
1841 default: 1841 default:
1842 return dev_ioctl(cmd,(void __user *) arg); 1842 return -ENOIOCTLCMD;
1843 } 1843 }
1844 /*NOTREACHED*/ 1844 /*NOTREACHED*/
1845} 1845}
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index ca8b3b0b920d..16459c7f54b2 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -1378,7 +1378,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1378 } 1378 }
1379 1379
1380 default: 1380 default:
1381 rc = dev_ioctl(cmd, argp); 1381 rc = -ENOIOCTLCMD;
1382 break; 1382 break;
1383 } 1383 }
1384 1384