Skip to content

Commit

Permalink
wext: Parameterize the standard/private handlers.
Browse files Browse the repository at this point in the history
The WEXT standard and private handlers to use are now
arguments to wireless_process_ioctl().

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller authored and David S. Miller committed Jun 17, 2008
1 parent 67dd760 commit ca1e8bb
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions net/wireless/wext.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,11 +1015,17 @@ static int ioctl_private_call(struct net_device *dev, struct ifreq *ifr,
}

/* ---------------------------------------------------------------- */
typedef int (*wext_ioctl_func)(struct net_device *, struct ifreq *,
unsigned int, iw_handler);

/*
* Main IOCTl dispatcher.
* Check the type of IOCTL and call the appropriate wrapper...
*/
static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd)
static int wireless_process_ioctl(struct net *net, struct ifreq *ifr,
unsigned int cmd,
wext_ioctl_func standard,
wext_ioctl_func private)
{
struct net_device *dev;
iw_handler handler;
Expand All @@ -1035,12 +1041,12 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, unsigned i
* Note that 'cmd' is already filtered in dev_ioctl() with
* (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */
if (cmd == SIOCGIWSTATS)
return ioctl_standard_call(dev, ifr, cmd,
&iw_handler_get_iwstats);
return standard(dev, ifr, cmd,
&iw_handler_get_iwstats);

if (cmd == SIOCGIWPRIV && dev->wireless_handlers)
return ioctl_standard_call(dev, ifr, cmd,
&iw_handler_get_private);
return standard(dev, ifr, cmd,
&iw_handler_get_private);

/* Basic check */
if (!netif_device_present(dev))
Expand All @@ -1051,9 +1057,9 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, unsigned i
if (handler) {
/* Standard and private are not the same */
if (cmd < SIOCIWFIRSTPRIV)
return ioctl_standard_call(dev, ifr, cmd, handler);
return standard(dev, ifr, cmd, handler);
else
return ioctl_private_call(dev, ifr, cmd, handler);
return private(dev, ifr, cmd, handler);
}
/* Old driver API : call driver ioctl handler */
if (dev->do_ioctl)
Expand Down Expand Up @@ -1084,7 +1090,9 @@ 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);
ret = wireless_process_ioctl(net, ifr, cmd,
ioctl_standard_call,
ioctl_private_call);
rtnl_unlock();
if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct iwreq)))
return -EFAULT;
Expand Down

0 comments on commit ca1e8bb

Please sign in to comment.