Thread (2 messages) 2 messages, 2 authors, 2018-09-27

Re: [PATCH] netlink: add policy attribute range validation

From: Johannes Berg <johannes@sipsolutions.net>
Date: 2018-09-27 15:09:00
Also in: linux-wireless

On Thu, 2018-09-27 at 10:48 +0200, Michal Kubecek wrote:
We could still use helper macros so this part could become

DEFINE_NLA_U8_RANGE(retry_range, 1, 255);

or

DEFINE_NLA_RANGE(retry_range, u8, 1, 255);
True.
quoted
policy[] = {
	...
	[NL80211_ATTR_WIPHY_RETRY_SHORT] = {
		.type = NLA_U8,
		.validation_data = &retry_range,
	},
	...
};
And this could be also shortened using a macro.

It would still be longer but not that much.
Right. You'd still have to name it, and then we'd probably eventually
want to share some common range definitions, but indeed it would work.
I didn't mean it as a serious objection, rather a note that the gain may
not be worth the additional complexity. 
Sure, and suggestions are very welcome. I was just trying to explain why
I chose this direction, more than anything else.
But if you want to follow in the
direction you indicated later (in particular, allowing different
interpretations of validation_data for the same type), overloading does
indeed make more sense.
I'm just working on the patches - give me a few more minutes.

johannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help