From: Pavel Emelyanov <xemul@parallels.com>
To: David Miller <davem@davemloft.net>,
Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH 1/13] inet_diag: Remove indirect sizeof from inet diag handlers
Date: Fri, 09 Dec 2011 20:21:16 +0400 [thread overview]
Message-ID: <4EE2357C.2080502@parallels.com> (raw)
In-Reply-To: <4EE23561.5020804@parallels.com>
There's an info_size value stored on inet_diag_handler, but for existing
code this value is effectively constant, so just use sizeof(struct tcp_info)
where required.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
---
include/linux/inet_diag.h | 1 -
net/dccp/diag.c | 1 -
net/ipv4/inet_diag.c | 5 ++---
net/ipv4/tcp_diag.c | 1 -
4 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index defe8ff..851feff 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -141,7 +141,6 @@ struct inet_diag_handler {
void (*idiag_get_info)(struct sock *sk,
struct inet_diag_msg *r,
void *info);
- __u16 idiag_info_size;
__u16 idiag_type;
};
diff --git a/net/dccp/diag.c b/net/dccp/diag.c
index 424dcd8..9343f52 100644
--- a/net/dccp/diag.c
+++ b/net/dccp/diag.c
@@ -52,7 +52,6 @@ static const struct inet_diag_handler dccp_diag_handler = {
.idiag_hashinfo = &dccp_hashinfo,
.idiag_get_info = dccp_diag_get_info,
.idiag_type = IPPROTO_DCCP,
- .idiag_info_size = sizeof(struct tcp_info),
};
static int __init dccp_diag_init(void)
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index b56b7ba..a247f85 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -98,8 +98,7 @@ static int inet_csk_diag_fill(struct sock *sk,
minfo = INET_DIAG_PUT(skb, INET_DIAG_MEMINFO, sizeof(*minfo));
if (ext & (1 << (INET_DIAG_INFO - 1)))
- info = INET_DIAG_PUT(skb, INET_DIAG_INFO,
- handler->idiag_info_size);
+ info = INET_DIAG_PUT(skb, INET_DIAG_INFO, sizeof(struct tcp_info));
if ((ext & (1 << (INET_DIAG_CONG - 1))) && icsk->icsk_ca_ops) {
const size_t len = strlen(icsk->icsk_ca_ops->name);
@@ -299,7 +298,7 @@ static int inet_diag_get_exact(struct sk_buff *in_skb,
err = -ENOMEM;
rep = alloc_skb(NLMSG_SPACE((sizeof(struct inet_diag_msg) +
sizeof(struct inet_diag_meminfo) +
- handler->idiag_info_size + 64)),
+ sizeof(struct tcp_info) + 64)),
GFP_KERNEL);
if (!rep)
goto out;
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index 9814977..42e6bec 100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -38,7 +38,6 @@ static const struct inet_diag_handler tcp_diag_handler = {
.idiag_hashinfo = &tcp_hashinfo,
.idiag_get_info = tcp_diag_get_info,
.idiag_type = IPPROTO_TCP,
- .idiag_info_size = sizeof(struct tcp_info),
};
static int __init tcp_diag_init(void)
--
1.5.5.6
next prev parent reply other threads:[~2011-12-09 16:21 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-09 16:20 [PATCH 0/13] Implement dumping udp sockets via sock_diag netlink Pavel Emelyanov
2011-12-09 16:21 ` Pavel Emelyanov [this message]
2011-12-09 16:21 ` [PATCH 2/13] inet_diag: Reduce the number of args for bytecode run routine Pavel Emelyanov
2011-12-09 16:21 ` [PATCH 3/13] inet_diag: Export inet diag cookie checking routine Pavel Emelyanov
2011-12-09 16:22 ` [PATCH 4/13] inet_diag: Split inet_diag_get_exact into parts Pavel Emelyanov
2011-12-09 16:22 ` [PATCH 5/13] " Pavel Emelyanov
2011-12-09 16:22 ` [PATCH 6/13] inet_diag: Introduce the byte-code run on an inet socket Pavel Emelyanov
2011-12-09 16:23 ` [PATCH 7/13] inet_diag: Introduce the inet socket dumping routine Pavel Emelyanov
2011-12-09 16:23 ` [PATCH 8/13] inet_diag: Generalize inet_diag dump and get_exact calls Pavel Emelyanov
2011-12-09 16:23 ` [PATCH 9/13] udp: Export code sk lookup routines Pavel Emelyanov
2011-12-09 16:23 ` [PATCH 10/13] udp_diag: Basic skeleton Pavel Emelyanov
2011-12-09 16:24 ` [PATCH 11/13] udp_diag: Implement the get_exact dumping functionality Pavel Emelyanov
2011-12-09 21:48 ` Eric Dumazet
2011-12-10 9:07 ` Pavel Emelyanov
2011-12-10 9:33 ` [PATCH 1/2] udp_diag: Make it module when ipv6 is a module Pavel Emelyanov
2011-12-10 9:35 ` [PATCH 2/2] udp_diag: Fix the !ipv6 case Pavel Emelyanov
2011-12-10 11:02 ` Eric Dumazet
2011-12-10 18:15 ` David Miller
2011-12-10 19:48 ` [PATCH net-next] net: use IS_ENABLED(CONFIG_IPV6) Eric Dumazet
2011-12-10 22:00 ` [PATCH net-next] drivers/net: " Joe Perches
2011-12-10 22:29 ` Eric Dumazet
2011-12-11 0:51 ` Joe Perches
2011-12-11 8:52 ` Eric Dumazet
2011-12-13 0:06 ` Joe Perches
2011-12-11 23:34 ` [PATCH net-next] net: " David Miller
2011-12-10 11:00 ` [PATCH 1/2] udp_diag: Make it module when ipv6 is a module Eric Dumazet
2011-12-10 18:15 ` David Miller
2011-12-09 16:24 ` [PATCH 12/13] udp_diag: Implement the dump-all functionality Pavel Emelyanov
2011-12-09 16:24 ` [PATCH 13/13] udp_diag: Wire the udp_diag module into kbuild Pavel Emelyanov
2011-12-09 16:26 ` [PATCH] iproute: Dump UDP sockets via netlink Pavel Emelyanov
2011-12-09 19:19 ` [PATCH 0/13] Implement dumping udp sockets via sock_diag netlink David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EE2357C.2080502@parallels.com \
--to=xemul@parallels.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).