From: Denis Kenzior <denkenz@gmail.com>
To: ell@lists.01.org
Subject: Re: [PATCH] genl: Add l_genl_msg_attr_append_data
Date: Wed, 05 Oct 2016 18:46:37 -0500 [thread overview]
Message-ID: <57F590DD.4050102@gmail.com> (raw)
In-Reply-To: <1475707520-25740-1-git-send-email-andrew.zaborowski@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]
Hi Andrew,
On 10/05/2016 05:45 PM, Andrew Zaborowski wrote:
> Try to minimise the amount of buffers allocated and copied by clients
> when building a message attribute that is a concatenation of other
> buffers, such as an IE sequence. The client would the following three
> calls:
>
> l_genl_msg_enter_nested
> l_genl_msg_attr_append_data
> l_genl_msg_leave_nested
So the intent here is that instead of:
msg = l_genl_msg_new_sized(...);
buf = alloca();
// memcpy / scribble in buffer
l_genl_msg_append_attr(msg, NL80211_ATTR_IE, buf_len, buf);
we do something like:
msg = l_genl_msg_new_sized(...);
l_genl_msg_enter_nested(msg, NL80211_ATTR_IE);
buf = l_genl_msg_attr_append_data(msg, len);
// scribble in buf
buf = l_genl_msg_attr_append_data(msg, len);
// scribble in buf
l_genl_msg_leave_nested(msg);
?
If so, you're (very creatively) really abusing the intent of
enter_nested which is used for true nested attributes. Don't think I
really like that...
Is l_genl_msg_append_attrv(msg, iov, iov_len) not sufficient?
Alternatively, we should do something like:
l_genl_msg_attr_open(msg, NL80211_ATTR_IE);
l_genl_msg_attr_reserve(msg, len);
l_genl_msg_attr_append(msg, len, data);
l_genl_msg_attr_reserve(msg, len);
l_genl_msg_attr_close(msg);
Regards,
-Denis
next prev parent reply other threads:[~2016-10-05 23:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-05 22:45 [PATCH] genl: Add l_genl_msg_attr_append_data Andrew Zaborowski
2016-10-05 23:46 ` Denis Kenzior [this message]
2016-10-06 0:31 ` Andrzej Zaborowski
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=57F590DD.4050102@gmail.com \
--to=denkenz@gmail.com \
--cc=ell@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.