lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 17 Mar 2010 09:08:32 -0700
From:	Johannes Berg <johannes@...solutions.net>
To:	Joe Perches <joe@...ches.com>
Cc:	Richard Kennedy <richard@....demon.co.uk>,
	Andy Whitcroft <apw@...onical.com>, gregkh@...e.de,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
	"John W. Linville" <linville@...driver.com>,
	linux-wireless <linux-wireless@...r.kernel.org>
Subject: Re: [PATCH] wireless.h: Add STD_IW_HANDLER macro

On Wed, 2010-03-17 at 09:05 -0700, Joe Perches wrote:

> > I copied it from driver/net/wireless/ipw2x00/ipw2200.c 
> > It just reduces typing when initialising the array :-
> > 	#define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT]
> > 	static iw_handler p80211wext_handlers[] = {
> > 		IW_IOCTL(SIOCSIWCOMMIT) = (iw_handler) p80211wext_siwcommit,
> > 		...
> > Oh, having quickly looked at wireless.h, I see there is already a macro
> > IW_IOCTL_IDX so I guess I should have used that!
> > would something like this be better?
> > 	static iw_handler p80211wext_handlers[] = {
> > 		[IW_IOCTL_IDX(SIOCSIWCOMMIT)] = (iw_handler) p80211wext_siwcommit,
> > 		...
> 
> orinoco uses one more macro indirection which seems reasonable
> 
> Maybe this define should be moved to wireless.h
> 
> #define STD_IW_HANDLER(id, func) \
> 	[IW_IOCTL_IDX(id)] = (iw_handler) func
> 
> the line continued macro probably avoids checkpatch warnings too...
> 
> orinoco use:
> 
> static const iw_handler	orinoco_handler[] = {
> 	STD_IW_HANDLER(SIOCSIWCOMMIT,	orinoco_ioctl_commit),
> 	STD_IW_HANDLER(SIOCGIWNAME,	cfg80211_wext_giwname),
> 
> Here's a suggested patch:
> 
> Signed-off-by: Joe Perches <joe@...ches.com>
> ---
> diff --git a/include/linux/wireless.h b/include/linux/wireless.h
> index 5b4c6c7..ad9f8d5 100644
> --- a/include/linux/wireless.h
> +++ b/include/linux/wireless.h
> @@ -346,6 +346,8 @@
>  #define SIOCIWFIRST	0x8B00
>  #define SIOCIWLAST	SIOCIWLASTPRIV		/* 0x8BFF */
>  #define IW_IOCTL_IDX(cmd)	((cmd) - SIOCIWFIRST)
> +#define STD_IW_HANDLER(id, func) \
> +	[IW_IOCTL_IDX(id)] = (iw_handler) func

Err, who still cares about wireless extensions (who isn't working on
net/wireless/wext*)?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ