From: Vadim Kochan <vadim4j@gmail.com>
To: Jiri Pirko <jiri@resnulli.us>
Cc: Vadim Kochan <vadim4j@gmail.com>,
stephen@networkplumber.org, netdev@vger.kernel.org
Subject: Re: [PATCH iproute2] lib: Replace 16384 netlink buf by macro
Date: Wed, 25 Feb 2015 21:42:34 +0200 [thread overview]
Message-ID: <20150225194234.GA3021@angus-think.lan> (raw)
In-Reply-To: <20150225164655.GL2039@nanopsycho.orion>
On Wed, Feb 25, 2015 at 05:46:55PM +0100, Jiri Pirko wrote:
> Wed, Feb 25, 2015 at 05:04:17PM CET, vadim4j@gmail.com wrote:
> >From: Vadim Kochan <vadim4j@gmail.com>
> >
> >Replaced hard coded 16384 sized netlink message buffer
> >by NL_BUF(x) macro.
> >
> >Buffer size can be overrided by -DNLBUF_SIZE.
> >
> >Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> >---
> > include/libnetlink.h | 6 ++++++
> > ip/iplink.c | 2 +-
> > lib/libnetlink.c | 8 ++++----
> > misc/ss.c | 2 +-
> > 4 files changed, 12 insertions(+), 6 deletions(-)
> >
> >diff --git a/include/libnetlink.h b/include/libnetlink.h
> >index 898275b..883f581 100644
> >--- a/include/libnetlink.h
> >+++ b/include/libnetlink.h
> >@@ -170,5 +170,11 @@ extern int rtnl_from_file(FILE *, rtnl_filter_t handler,
> > * messages from dump file */
> > #define NLMSG_TSTAMP 15
> >
> >+#ifndef NLBUF_SIZE
> >+#define NLBUF_SIZE 16384
> >+#endif
> >+
> >+#define NL_BUF(b) char b[NLBUF_SIZE]
> >+
> > #endif /* __LIBNETLINK_H__ */
> >
> >diff --git a/ip/iplink.c b/ip/iplink.c
> >index 5893ee4..b9949a8 100644
> >--- a/ip/iplink.c
> >+++ b/ip/iplink.c
> >@@ -770,7 +770,7 @@ int iplink_get(unsigned int flags, char *name, __u32 filt_mask)
> > {
> > int len;
> > struct iplink_req req;
> >- char answer[16384];
> >+ NL_BUF(answer);
>
> Why to obfuscate this? "char answer[NLBUF_SIZE];" seems allright...
>
Well, I thought that it would be easy to change the netlink buffer type
in the future, but may be you're right - "char answer[NLBUF_SIZE];" is
more readable anyway.
Thanks,
prev parent reply other threads:[~2015-02-25 19:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-25 16:04 [PATCH iproute2] lib: Replace 16384 netlink buf by macro Vadim Kochan
2015-02-25 16:46 ` Jiri Pirko
2015-02-25 19:42 ` Vadim Kochan [this message]
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=20150225194234.GA3021@angus-think.lan \
--to=vadim4j@gmail.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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).