diff options
author | David S. Miller <davem@davemloft.net> | 2008-06-03 07:36:30 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-16 18:32:09 -0700 |
commit | a67fa76d8be4e24e2d61cd76438a893d4c2886f7 (patch) | |
tree | 6a5057e228bd05f83ef5e04a8e2d91198399b3be /net/wireless | |
parent | d2911255590d9ca561a481b9dbebcfcbbf38fa4e (diff) | |
download | linux-a67fa76d8be4e24e2d61cd76438a893d4c2886f7.tar.bz2 |
wext: Pull top-level ioctl dispatch logic into helper function.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/wext.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/net/wireless/wext.c b/net/wireless/wext.c index e9c88172ec55..09022cbb58ba 100644 --- a/net/wireless/wext.c +++ b/net/wireless/wext.c @@ -1079,8 +1079,10 @@ static int wext_permission_check(unsigned int cmd) } /* entry point from dev ioctl */ -int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, - void __user *arg) +static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr, + unsigned int cmd, + wext_ioctl_func standard, + wext_ioctl_func private) { int ret = wext_permission_check(cmd); @@ -1089,12 +1091,24 @@ int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, dev_load(net, ifr->ifr_name); rtnl_lock(); - ret = wireless_process_ioctl(net, ifr, cmd, - ioctl_standard_call, - ioctl_private_call); + ret = wireless_process_ioctl(net, ifr, cmd, standard, private); rtnl_unlock(); - if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct iwreq))) + + return ret; +} + +int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, + void __user *arg) +{ + int ret = wext_ioctl_dispatch(net, ifr, cmd, + ioctl_standard_call, + ioctl_private_call); + + if (ret >= 0 && + IW_IS_GET(cmd) && + copy_to_user(arg, ifr, sizeof(struct iwreq))) return -EFAULT; + return ret; } |