diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-12-21 06:41:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-16 21:30:59 -0400 |
commit | ca1e8bb8e4e89e2769e2b39eb29fdcfc5c19cf89 (patch) | |
tree | 7a810b35b6f584b3176b42d35c30bcd7d79db11f /net/wireless/wext.c | |
parent | 67dd7608078b17f63f29ff2108fc5bf2407ddcec (diff) |
wext: Parameterize the standard/private handlers.
The WEXT standard and private handlers to use are now
arguments to wireless_process_ioctl().
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/wireless/wext.c')
-rw-r--r-- | net/wireless/wext.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/net/wireless/wext.c b/net/wireless/wext.c index e96559ea0fb3..929d24120f37 100644 --- a/net/wireless/wext.c +++ b/net/wireless/wext.c | |||
@@ -1015,11 +1015,17 @@ static int ioctl_private_call(struct net_device *dev, struct ifreq *ifr, | |||
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | /* ---------------------------------------------------------------- */ | 1017 | /* ---------------------------------------------------------------- */ |
1018 | typedef int (*wext_ioctl_func)(struct net_device *, struct ifreq *, | ||
1019 | unsigned int, iw_handler); | ||
1020 | |||
1018 | /* | 1021 | /* |
1019 | * Main IOCTl dispatcher. | 1022 | * Main IOCTl dispatcher. |
1020 | * Check the type of IOCTL and call the appropriate wrapper... | 1023 | * Check the type of IOCTL and call the appropriate wrapper... |
1021 | */ | 1024 | */ |
1022 | static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd) | 1025 | static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, |
1026 | unsigned int cmd, | ||
1027 | wext_ioctl_func standard, | ||
1028 | wext_ioctl_func private) | ||
1023 | { | 1029 | { |
1024 | struct net_device *dev; | 1030 | struct net_device *dev; |
1025 | iw_handler handler; | 1031 | iw_handler handler; |
@@ -1035,12 +1041,12 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, unsigned i | |||
1035 | * Note that 'cmd' is already filtered in dev_ioctl() with | 1041 | * Note that 'cmd' is already filtered in dev_ioctl() with |
1036 | * (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */ | 1042 | * (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */ |
1037 | if (cmd == SIOCGIWSTATS) | 1043 | if (cmd == SIOCGIWSTATS) |
1038 | return ioctl_standard_call(dev, ifr, cmd, | 1044 | return standard(dev, ifr, cmd, |
1039 | &iw_handler_get_iwstats); | 1045 | &iw_handler_get_iwstats); |
1040 | 1046 | ||
1041 | if (cmd == SIOCGIWPRIV && dev->wireless_handlers) | 1047 | if (cmd == SIOCGIWPRIV && dev->wireless_handlers) |
1042 | return ioctl_standard_call(dev, ifr, cmd, | 1048 | return standard(dev, ifr, cmd, |
1043 | &iw_handler_get_private); | 1049 | &iw_handler_get_private); |
1044 | 1050 | ||
1045 | /* Basic check */ | 1051 | /* Basic check */ |
1046 | if (!netif_device_present(dev)) | 1052 | if (!netif_device_present(dev)) |
@@ -1051,9 +1057,9 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, unsigned i | |||
1051 | if (handler) { | 1057 | if (handler) { |
1052 | /* Standard and private are not the same */ | 1058 | /* Standard and private are not the same */ |
1053 | if (cmd < SIOCIWFIRSTPRIV) | 1059 | if (cmd < SIOCIWFIRSTPRIV) |
1054 | return ioctl_standard_call(dev, ifr, cmd, handler); | 1060 | return standard(dev, ifr, cmd, handler); |
1055 | else | 1061 | else |
1056 | return ioctl_private_call(dev, ifr, cmd, handler); | 1062 | return private(dev, ifr, cmd, handler); |
1057 | } | 1063 | } |
1058 | /* Old driver API : call driver ioctl handler */ | 1064 | /* Old driver API : call driver ioctl handler */ |
1059 | if (dev->do_ioctl) | 1065 | if (dev->do_ioctl) |
@@ -1084,7 +1090,9 @@ int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, | |||
1084 | 1090 | ||
1085 | dev_load(net, ifr->ifr_name); | 1091 | dev_load(net, ifr->ifr_name); |
1086 | rtnl_lock(); | 1092 | rtnl_lock(); |
1087 | ret = wireless_process_ioctl(net, ifr, cmd); | 1093 | ret = wireless_process_ioctl(net, ifr, cmd, |
1094 | ioctl_standard_call, | ||
1095 | ioctl_private_call); | ||
1088 | rtnl_unlock(); | 1096 | rtnl_unlock(); |
1089 | if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct iwreq))) | 1097 | if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct iwreq))) |
1090 | return -EFAULT; | 1098 | return -EFAULT; |