Commit 90800216 authored by Herbert Xu's avatar Herbert Xu

nlattr: Fix build error with NET off

We moved the netlink attribute support from net to lib in order
for it to be available for general consumption.  However, parts
of the code (the bits that we don't need :) really depends on
NET because the target object is sk_buff.

This patch fixes this by wrapping them in CONFIG_NET.

Some EXPORTs have been moved to make this work.
Tested-by: default avatarGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 0c01aed5
...@@ -281,6 +281,7 @@ int nla_strcmp(const struct nlattr *nla, const char *str) ...@@ -281,6 +281,7 @@ int nla_strcmp(const struct nlattr *nla, const char *str)
return d; return d;
} }
#ifdef CONFIG_NET
/** /**
* __nla_reserve - reserve room for attribute on the skb * __nla_reserve - reserve room for attribute on the skb
* @skb: socket buffer to reserve room on * @skb: socket buffer to reserve room on
...@@ -305,6 +306,7 @@ struct nlattr *__nla_reserve(struct sk_buff *skb, int attrtype, int attrlen) ...@@ -305,6 +306,7 @@ struct nlattr *__nla_reserve(struct sk_buff *skb, int attrtype, int attrlen)
return nla; return nla;
} }
EXPORT_SYMBOL(__nla_reserve);
/** /**
* __nla_reserve_nohdr - reserve room for attribute without header * __nla_reserve_nohdr - reserve room for attribute without header
...@@ -325,6 +327,7 @@ void *__nla_reserve_nohdr(struct sk_buff *skb, int attrlen) ...@@ -325,6 +327,7 @@ void *__nla_reserve_nohdr(struct sk_buff *skb, int attrlen)
return start; return start;
} }
EXPORT_SYMBOL(__nla_reserve_nohdr);
/** /**
* nla_reserve - reserve room for attribute on the skb * nla_reserve - reserve room for attribute on the skb
...@@ -345,6 +348,7 @@ struct nlattr *nla_reserve(struct sk_buff *skb, int attrtype, int attrlen) ...@@ -345,6 +348,7 @@ struct nlattr *nla_reserve(struct sk_buff *skb, int attrtype, int attrlen)
return __nla_reserve(skb, attrtype, attrlen); return __nla_reserve(skb, attrtype, attrlen);
} }
EXPORT_SYMBOL(nla_reserve);
/** /**
* nla_reserve_nohdr - reserve room for attribute without header * nla_reserve_nohdr - reserve room for attribute without header
...@@ -363,6 +367,7 @@ void *nla_reserve_nohdr(struct sk_buff *skb, int attrlen) ...@@ -363,6 +367,7 @@ void *nla_reserve_nohdr(struct sk_buff *skb, int attrlen)
return __nla_reserve_nohdr(skb, attrlen); return __nla_reserve_nohdr(skb, attrlen);
} }
EXPORT_SYMBOL(nla_reserve_nohdr);
/** /**
* __nla_put - Add a netlink attribute to a socket buffer * __nla_put - Add a netlink attribute to a socket buffer
...@@ -382,6 +387,7 @@ void __nla_put(struct sk_buff *skb, int attrtype, int attrlen, ...@@ -382,6 +387,7 @@ void __nla_put(struct sk_buff *skb, int attrtype, int attrlen,
nla = __nla_reserve(skb, attrtype, attrlen); nla = __nla_reserve(skb, attrtype, attrlen);
memcpy(nla_data(nla), data, attrlen); memcpy(nla_data(nla), data, attrlen);
} }
EXPORT_SYMBOL(__nla_put);
/** /**
* __nla_put_nohdr - Add a netlink attribute without header * __nla_put_nohdr - Add a netlink attribute without header
...@@ -399,6 +405,7 @@ void __nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data) ...@@ -399,6 +405,7 @@ void __nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data)
start = __nla_reserve_nohdr(skb, attrlen); start = __nla_reserve_nohdr(skb, attrlen);
memcpy(start, data, attrlen); memcpy(start, data, attrlen);
} }
EXPORT_SYMBOL(__nla_put_nohdr);
/** /**
* nla_put - Add a netlink attribute to a socket buffer * nla_put - Add a netlink attribute to a socket buffer
...@@ -418,6 +425,7 @@ int nla_put(struct sk_buff *skb, int attrtype, int attrlen, const void *data) ...@@ -418,6 +425,7 @@ int nla_put(struct sk_buff *skb, int attrtype, int attrlen, const void *data)
__nla_put(skb, attrtype, attrlen, data); __nla_put(skb, attrtype, attrlen, data);
return 0; return 0;
} }
EXPORT_SYMBOL(nla_put);
/** /**
* nla_put_nohdr - Add a netlink attribute without header * nla_put_nohdr - Add a netlink attribute without header
...@@ -436,6 +444,7 @@ int nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data) ...@@ -436,6 +444,7 @@ int nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data)
__nla_put_nohdr(skb, attrlen, data); __nla_put_nohdr(skb, attrlen, data);
return 0; return 0;
} }
EXPORT_SYMBOL(nla_put_nohdr);
/** /**
* nla_append - Add a netlink attribute without header or padding * nla_append - Add a netlink attribute without header or padding
...@@ -454,20 +463,13 @@ int nla_append(struct sk_buff *skb, int attrlen, const void *data) ...@@ -454,20 +463,13 @@ int nla_append(struct sk_buff *skb, int attrlen, const void *data)
memcpy(skb_put(skb, attrlen), data, attrlen); memcpy(skb_put(skb, attrlen), data, attrlen);
return 0; return 0;
} }
EXPORT_SYMBOL(nla_append);
#endif
EXPORT_SYMBOL(nla_validate); EXPORT_SYMBOL(nla_validate);
EXPORT_SYMBOL(nla_parse); EXPORT_SYMBOL(nla_parse);
EXPORT_SYMBOL(nla_find); EXPORT_SYMBOL(nla_find);
EXPORT_SYMBOL(nla_strlcpy); EXPORT_SYMBOL(nla_strlcpy);
EXPORT_SYMBOL(__nla_reserve);
EXPORT_SYMBOL(__nla_reserve_nohdr);
EXPORT_SYMBOL(nla_reserve);
EXPORT_SYMBOL(nla_reserve_nohdr);
EXPORT_SYMBOL(__nla_put);
EXPORT_SYMBOL(__nla_put_nohdr);
EXPORT_SYMBOL(nla_put);
EXPORT_SYMBOL(nla_put_nohdr);
EXPORT_SYMBOL(nla_memcpy); EXPORT_SYMBOL(nla_memcpy);
EXPORT_SYMBOL(nla_memcmp); EXPORT_SYMBOL(nla_memcmp);
EXPORT_SYMBOL(nla_strcmp); EXPORT_SYMBOL(nla_strcmp);
EXPORT_SYMBOL(nla_append);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment