* [2.6 patch] rtnetlink.c: #if 0 no longer used functions
@ 2008-01-30 20:02 Adrian Bunk
2008-01-30 20:04 ` Patrick McHardy
0 siblings, 1 reply; 6+ messages in thread
From: Adrian Bunk @ 2008-01-30 20:02 UTC (permalink / raw)
To: Patrick McHardy, David S. Miller; +Cc: netdev
This patch #if 0's the following no longer used functions:
- rtattr_parse()
- rtattr_strlcpy()
- __rtattr_parse_nested_compat()
Signed-off-by: Adrian Bunk <bunk@kernel.org>
---
include/linux/rtnetlink.h | 12 ------------
net/core/rtnetlink.c | 9 ++++++---
2 files changed, 6 insertions(+), 15 deletions(-)
06cd9ace5f9ca3d8070364d33ca76d1fa4cd203b
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index b014f6b..b9e1740 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -602,24 +602,12 @@ struct tcamsg
#include <linux/mutex.h>
-extern size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size);
static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str)
{
int len = strlen(str) + 1;
return len > rta->rta_len || memcmp(RTA_DATA(rta), str, len);
}
-extern int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, int len);
-extern int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr,
- struct rtattr *rta, int len);
-
-#define rtattr_parse_nested(tb, max, rta) \
- rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta)))
-
-#define rtattr_parse_nested_compat(tb, max, rta, data, len) \
-({ data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \
- __rtattr_parse_nested_compat(tb, max, rta, len); })
-
extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid);
extern int rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group,
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index ddbdde8..a689f17 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -82,6 +82,8 @@ int rtnl_trylock(void)
return mutex_trylock(&rtnl_mutex);
}
+#if 0
+
int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, int len)
{
memset(tb, 0, sizeof(struct rtattr*)*maxattr);
@@ -108,6 +110,8 @@ int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr,
return 0;
}
+#endif /* 0 */
+
static struct rtnl_link *rtnl_msg_handlers[NPROTO];
static inline int rtm_msgindex(int msgtype)
@@ -442,6 +446,7 @@ void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data
memset(RTA_DATA(rta) + attrlen, 0, RTA_ALIGN(size) - size);
}
+#if 0
size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size)
{
size_t ret = RTA_PAYLOAD(rta);
@@ -456,6 +461,7 @@ size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size)
}
return ret;
}
+#endif /* 0 */
int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned group, int echo)
{
@@ -1411,9 +1417,6 @@ void __init rtnetlink_init(void)
}
EXPORT_SYMBOL(__rta_fill);
-EXPORT_SYMBOL(rtattr_strlcpy);
-EXPORT_SYMBOL(rtattr_parse);
-EXPORT_SYMBOL(__rtattr_parse_nested_compat);
EXPORT_SYMBOL(rtnetlink_put_metrics);
EXPORT_SYMBOL(rtnl_lock);
EXPORT_SYMBOL(rtnl_trylock);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [2.6 patch] rtnetlink.c: #if 0 no longer used functions
2008-01-30 20:02 [2.6 patch] rtnetlink.c: #if 0 no longer used functions Adrian Bunk
@ 2008-01-30 20:04 ` Patrick McHardy
2008-02-01 1:17 ` David Miller
2008-02-01 16:19 ` [2.6 patch] rtnetlink.c: remove " Adrian Bunk
0 siblings, 2 replies; 6+ messages in thread
From: Patrick McHardy @ 2008-01-30 20:04 UTC (permalink / raw)
To: Adrian Bunk; +Cc: David S. Miller, netdev
Adrian Bunk wrote:
> This patch #if 0's the following no longer used functions:
> - rtattr_parse()
> - rtattr_strlcpy()
> - __rtattr_parse_nested_compat()
>
Please remove them instead.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [2.6 patch] rtnetlink.c: #if 0 no longer used functions
2008-01-30 20:04 ` Patrick McHardy
@ 2008-02-01 1:17 ` David Miller
2008-02-01 7:00 ` Patrick McHardy
2008-02-01 16:19 ` [2.6 patch] rtnetlink.c: remove " Adrian Bunk
1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2008-02-01 1:17 UTC (permalink / raw)
To: kaber; +Cc: bunk, netdev
From: Patrick McHardy <kaber@trash.net>
Date: Wed, 30 Jan 2008 21:04:33 +0100
> Adrian Bunk wrote:
> > This patch #if 0's the following no longer used functions:
> > - rtattr_parse()
> > - rtattr_strlcpy()
> > - __rtattr_parse_nested_compat()
> >
>
> Please remove them instead.
Agreed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [2.6 patch] rtnetlink.c: #if 0 no longer used functions
2008-02-01 1:17 ` David Miller
@ 2008-02-01 7:00 ` Patrick McHardy
0 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2008-02-01 7:00 UTC (permalink / raw)
To: David Miller; +Cc: bunk, netdev
David Miller wrote:
> From: Patrick McHardy <kaber@trash.net>
> Date: Wed, 30 Jan 2008 21:04:33 +0100
>
>> Adrian Bunk wrote:
>>> This patch #if 0's the following no longer used functions:
>>> - rtattr_parse()
>>> - rtattr_strlcpy()
>>> - __rtattr_parse_nested_compat()
>>>
>> Please remove them instead.
>
> Agreed.
The rtattr_parse_nested_compat macro can also go away.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [2.6 patch] rtnetlink.c: remove no longer used functions
2008-01-30 20:04 ` Patrick McHardy
2008-02-01 1:17 ` David Miller
@ 2008-02-01 16:19 ` Adrian Bunk
2008-02-05 11:17 ` David Miller
1 sibling, 1 reply; 6+ messages in thread
From: Adrian Bunk @ 2008-02-01 16:19 UTC (permalink / raw)
To: Patrick McHardy; +Cc: David S. Miller, netdev
On Wed, Jan 30, 2008 at 09:04:33PM +0100, Patrick McHardy wrote:
> Adrian Bunk wrote:
>> This patch #if 0's the following no longer used functions:
>> - rtattr_parse()
>> - rtattr_strlcpy()
>> - __rtattr_parse_nested_compat()
>>
>
> Please remove them instead.
Updated patch below.
cu
Adrian
<-- snip -->
This patch removes the following no longer used functions:
- rtattr_parse()
- rtattr_strlcpy()
- __rtattr_parse_nested_compat()
Signed-off-by: Adrian Bunk <bunk@kernel.org>
---
include/linux/rtnetlink.h | 12 ----------
net/core/rtnetlink.c | 44 --------------------------------------
2 files changed, 56 deletions(-)
dcfe6b63a05c4944afcfc22fd4f2d2b495dc04c6
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index b014f6b..b9e1740 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -602,24 +602,12 @@ struct tcamsg
#include <linux/mutex.h>
-extern size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size);
static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str)
{
int len = strlen(str) + 1;
return len > rta->rta_len || memcmp(RTA_DATA(rta), str, len);
}
-extern int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, int len);
-extern int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr,
- struct rtattr *rta, int len);
-
-#define rtattr_parse_nested(tb, max, rta) \
- rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta)))
-
-#define rtattr_parse_nested_compat(tb, max, rta, data, len) \
-({ data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \
- __rtattr_parse_nested_compat(tb, max, rta, len); })
-
extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid);
extern int rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group,
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index ddbdde8..61ac8d0 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -82,32 +82,6 @@ int rtnl_trylock(void)
return mutex_trylock(&rtnl_mutex);
}
-int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, int len)
-{
- memset(tb, 0, sizeof(struct rtattr*)*maxattr);
-
- while (RTA_OK(rta, len)) {
- unsigned flavor = rta->rta_type;
- if (flavor && flavor <= maxattr)
- tb[flavor-1] = rta;
- rta = RTA_NEXT(rta, len);
- }
- return 0;
-}
-
-int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr,
- struct rtattr *rta, int len)
-{
- if (RTA_PAYLOAD(rta) < len)
- return -1;
- if (RTA_PAYLOAD(rta) >= RTA_ALIGN(len) + sizeof(struct rtattr)) {
- rta = RTA_DATA(rta) + RTA_ALIGN(len);
- return rtattr_parse_nested(tb, maxattr, rta);
- }
- memset(tb, 0, sizeof(struct rtattr *) * maxattr);
- return 0;
-}
-
static struct rtnl_link *rtnl_msg_handlers[NPROTO];
static inline int rtm_msgindex(int msgtype)
@@ -442,21 +416,6 @@ void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data
memset(RTA_DATA(rta) + attrlen, 0, RTA_ALIGN(size) - size);
}
-size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size)
-{
- size_t ret = RTA_PAYLOAD(rta);
- char *src = RTA_DATA(rta);
-
- if (ret > 0 && src[ret - 1] == '\0')
- ret--;
- if (size > 0) {
- size_t len = (ret >= size) ? size - 1 : ret;
- memset(dest, 0, size);
- memcpy(dest, src, len);
- }
- return ret;
-}
-
int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned group, int echo)
{
struct sock *rtnl = net->rtnl;
@@ -1411,9 +1370,6 @@ void __init rtnetlink_init(void)
}
EXPORT_SYMBOL(__rta_fill);
-EXPORT_SYMBOL(rtattr_strlcpy);
-EXPORT_SYMBOL(rtattr_parse);
-EXPORT_SYMBOL(__rtattr_parse_nested_compat);
EXPORT_SYMBOL(rtnetlink_put_metrics);
EXPORT_SYMBOL(rtnl_lock);
EXPORT_SYMBOL(rtnl_trylock);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [2.6 patch] rtnetlink.c: remove no longer used functions
2008-02-01 16:19 ` [2.6 patch] rtnetlink.c: remove " Adrian Bunk
@ 2008-02-05 11:17 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2008-02-05 11:17 UTC (permalink / raw)
To: bunk; +Cc: kaber, netdev
From: Adrian Bunk <bunk@kernel.org>
Date: Fri, 1 Feb 2008 18:19:04 +0200
> On Wed, Jan 30, 2008 at 09:04:33PM +0100, Patrick McHardy wrote:
> > Adrian Bunk wrote:
> >> This patch #if 0's the following no longer used functions:
> >> - rtattr_parse()
> >> - rtattr_strlcpy()
> >> - __rtattr_parse_nested_compat()
> >>
> >
> > Please remove them instead.
>
> Updated patch below.
Applied, thanks Adrian.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-02-05 11:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-30 20:02 [2.6 patch] rtnetlink.c: #if 0 no longer used functions Adrian Bunk
2008-01-30 20:04 ` Patrick McHardy
2008-02-01 1:17 ` David Miller
2008-02-01 7:00 ` Patrick McHardy
2008-02-01 16:19 ` [2.6 patch] rtnetlink.c: remove " Adrian Bunk
2008-02-05 11:17 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).