diff options
author | David S. Miller <davem@davemloft.net> | 2008-06-03 10:36:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-16 21:32:09 -0400 |
commit | a67fa76d8be4e24e2d61cd76438a893d4c2886f7 (patch) | |
tree | 6a5057e228bd05f83ef5e04a8e2d91198399b3be /net/wireless | |
parent | d2911255590d9ca561a481b9dbebcfcbbf38fa4e (diff) |
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) | |||
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | /* entry point from dev ioctl */ | 1081 | /* entry point from dev ioctl */ |
1082 | int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, | 1082 | static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr, |
1083 | void __user *arg) | 1083 | unsigned int cmd, |
1084 | wext_ioctl_func standard, | ||
1085 | wext_ioctl_func private) | ||
1084 | { | 1086 | { |
1085 | int ret = wext_permission_check(cmd); | 1087 | int ret = wext_permission_check(cmd); |
1086 | 1088 | ||
@@ -1089,12 +1091,24 @@ int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, | |||
1089 | 1091 | ||
1090 | dev_load(net, ifr->ifr_name); | 1092 | dev_load(net, ifr->ifr_name); |
1091 | rtnl_lock(); | 1093 | rtnl_lock(); |
1092 | ret = wireless_process_ioctl(net, ifr, cmd, | 1094 | ret = wireless_process_ioctl(net, ifr, cmd, standard, private); |
1093 | ioctl_standard_call, | ||
1094 | ioctl_private_call); | ||
1095 | rtnl_unlock(); | 1095 | rtnl_unlock(); |
1096 | if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct iwreq))) | 1096 | |
1097 | return ret; | ||
1098 | } | ||
1099 | |||
1100 | int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, | ||
1101 | void __user *arg) | ||
1102 | { | ||
1103 | int ret = wext_ioctl_dispatch(net, ifr, cmd, | ||
1104 | ioctl_standard_call, | ||
1105 | ioctl_private_call); | ||
1106 | |||
1107 | if (ret >= 0 && | ||
1108 | IW_IS_GET(cmd) && | ||
1109 | copy_to_user(arg, ifr, sizeof(struct iwreq))) | ||
1097 | return -EFAULT; | 1110 | return -EFAULT; |
1111 | |||
1098 | return ret; | 1112 | return ret; |
1099 | } | 1113 | } |
1100 | 1114 | ||