From 941d8ebcf773fd5da5c79e1c86e1afaae7032a0b Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Mon, 27 Oct 2014 16:12:16 +0900 Subject: datapath: Rename last_action() as nla_is_last() and move to netlink.h The original motivation for this change was to allow the helper to be used in files other than actions.c as part of work on an odp select group action. It was as pointed out by Thomas Graf that this helper would be best off living in netlink.h. Furthermore, I think that the generic nature of this helper means it is best off in netlink.h regardless of if it is used more than one .c file or not. Thus, I would like it considered independent of the work on an odp select group action. Cc: Thomas Graf Cc: Pravin Shelar Cc: Andy Zhou Signed-off-by: Simon Horman Acked-by: Thomas Graf Signed-off-by: David S. Miller --- include/net/netlink.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/net/netlink.h') diff --git a/include/net/netlink.h b/include/net/netlink.h index 7b903e1bdbbb..64158353ecb2 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h @@ -1185,4 +1185,14 @@ static inline int nla_validate_nested(const struct nlattr *start, int maxtype, #define nla_for_each_nested(pos, nla, rem) \ nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem) +/** + * nla_is_last - Test if attribute is last in stream + * @nla: attribute to test + * @rem: bytes remaining in stream + */ +static inline bool nla_is_last(const struct nlattr *nla, int rem) +{ + return nla->nla_len == rem; +} + #endif -- cgit v1.2.1