netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netlink: get rid of the useless function of nlmsg_get_pos()
@ 2012-10-25 10:00 zhanghonghui
  2012-10-25 19:44 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: zhanghonghui @ 2012-10-25 10:00 UTC (permalink / raw)
  To: davem, kuznet, jmorris, lizefan, netdev; +Cc: Hans Zhang

From: Hans Zhang <zhanghonghui@huawei.com>

This function just report the pointer of skb->tail, and there's only
one use in the kernel.

Signed-off-by: Hans Zhang <zhanghonghui@huawei.com>
---
 include/net/netlink.h    |   12 ------------
 net/ipv4/fib_semantics.c |    2 +-
 2 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/include/net/netlink.h b/include/net/netlink.h
index 9690b0f..ca36b08 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -36,7 +36,6 @@
  *   nlmsg_put()			add a netlink message to an skb
  *   nlmsg_put_answer()			callback based nlmsg_put()
  *   nlmsg_end()			finalize netlink message
- *   nlmsg_get_pos()			return current position in message
  *   nlmsg_trim()			trim part of message
  *   nlmsg_cancel()			cancel message construction
  *   nlmsg_free()			free a netlink message
@@ -514,17 +513,6 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
 }
 
 /**
- * nlmsg_get_pos - return current position in netlink message
- * @skb: socket buffer the message is stored in
- *
- * Returns a pointer to the current tail of the message.
- */
-static inline void *nlmsg_get_pos(struct sk_buff *skb)
-{
-	return skb_tail_pointer(skb);
-}
-
-/**
  * nlmsg_trim - Trim message to a mark
  * @skb: socket buffer the message is stored in
  * @mark: mark to trim to
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 4797a80..8d047bf 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1072,7 +1072,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
 				goto nla_put_failure;
 #endif
 			/* length of rtnetlink header + attributes */
-			rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *) rtnh;
+			rtnh->rtnh_len = (void *) skb_tail_pointer(skb) - (void *) rtnh;
 		} endfor_nexthops(fi);
 
 		nla_nest_end(skb, mp);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] netlink: get rid of the useless function of nlmsg_get_pos()
  2012-10-25 10:00 [PATCH] netlink: get rid of the useless function of nlmsg_get_pos() zhanghonghui
@ 2012-10-25 19:44 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-10-25 19:44 UTC (permalink / raw)
  To: zhanghonghui; +Cc: kuznet, jmorris, lizefan, netdev

From: <zhanghonghui@huawei.com>
Date: Thu, 25 Oct 2012 18:00:08 +0800

> From: Hans Zhang <zhanghonghui@huawei.com>
> 
> This function just report the pointer of skb->tail, and there's only
> one use in the kernel.
> 
> Signed-off-by: Hans Zhang <zhanghonghui@huawei.com>

I'm not applying this.

It is obviously useful to somebody, otherwise you wouldn't need
to do anything other than remove the implementation.

It provides an implicit cast, and in that sense it's useful.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-25 19:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-25 10:00 [PATCH] netlink: get rid of the useless function of nlmsg_get_pos() zhanghonghui
2012-10-25 19:44 ` 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).