Skip to contentSkip to conversation

rtnetlink.c: #if 0 no longer used functions

PATCH In review Adrian Bunk 3 participants 6 messages Jan 30, 2008 – Feb 5, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtnetlink.c: #if 0 no longer used functions

This patch #if 0's the following no longer used functions:
- rtattr_parse()
- rtattr_strlcpy()
- __rtattr_parse_nested_compat()

---

 include/linux/rtnetlink.h |   12 ------------
 net/core/rtnetlink.c      |    9 ++++++---
 2 files changed, 6 insertions(+), 15 deletions(-)

06cd9ace5f9ca3d8070364d33ca76d1fa4cd203b

include/linux/rtnetlink.h +0 -12
index b014f6b..b9e1740 100644
@@ -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,
net/core/rtnetlink.c +6 -3
index ddbdde8..a689f17 100644
@@ -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);
#1 lore raw
Quoted 5 lines · Adrian Bunk

This patch #if 0's the following no longer used functions:
- rtattr_parse()
- rtattr_strlcpy()
- __rtattr_parse_nested_compat()

Please remove them instead.

maintainer
#2 lore raw

From: Patrick McHardy <[email protected]>
Date: Wed, 30 Jan 2008 21:04:33 +0100

Quoted 8 lines
Quoted 5 lines · Adrian Bunk

This patch #if 0's the following no longer used functions:
- rtattr_parse()
- rtattr_strlcpy()
- __rtattr_parse_nested_compat()

Please remove them instead.

Agreed.

#3 lore raw
Quoted 4 lines · David Miller

From: Patrick McHardy <[email protected]>
Date: Wed, 30 Jan 2008 21:04:33 +0100

Quoted 1 line

Adrian Bunk wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

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.

#4 lore raw

PATCH 1/1 rtnetlink.c: remove no longer used functions

In reply to Patrick McHardy
Quoted 8 lines · Patrick McHardy
Quoted 5 lines · Adrian Bunk

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()

---

 include/linux/rtnetlink.h |   12 ----------
 net/core/rtnetlink.c      |   44 --------------------------------------
 2 files changed, 56 deletions(-)

dcfe6b63a05c4944afcfc22fd4f2d2b495dc04c6

include/linux/rtnetlink.h +0 -12
index b014f6b..b9e1740 100644
@@ -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,
net/core/rtnetlink.c +0 -44

62 lines not on this page · raw message

maintainer Applied
#5 lore raw

Re: [2.6 patch] rtnetlink.c: remove no longer used functions

From: Adrian Bunk <[email protected]>
Date: Fri, 1 Feb 2008 18:19:04 +0200

Quoted 11 lines · Patrick McHardy
Quoted 8 lines
Quoted 5 lines · Adrian Bunk

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.