From: Josh Triplett <josh@joshtriplett.org>
To: Pieter Smith <pieter@boesman.nl>
Cc: "David S. Miller" <davem@davemloft.net>,
Tom Herbert <therbert@google.com>,
Eric Dumazet <edumazet@google.com>,
Daniel Borkmann <dborkman@redhat.com>,
Willem de Bruijn <willemb@google.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Alexander Duyck <alexander.h.duyck@intel.com>,
Paul Durrant <Paul.Durrant@citrix.com>,
Thomas Graf <tgraf@suug.ch>, Jan Beulich <JBeulich@suse.com>,
Miklos Szeredi <mszeredi@suse.cz>,
open list <linux-kernel@vger.kernel.org>,
"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>
Subject: Re: [PATCH 5/6] net/core: support compiling out splice
Date: Sat, 22 Nov 2014 13:48:53 -0800 [thread overview]
Message-ID: <20141122214853.GB23711@thin> (raw)
In-Reply-To: <1416690001-20817-6-git-send-email-pieter@boesman.nl>
On Sat, Nov 22, 2014 at 10:00:00PM +0100, Pieter Smith wrote:
> Compile out splice support from networking core when the splice-family of
> syscalls is not supported by the system (i.e. CONFIG_SYSCALL_SPLICE is
> undefined).
Please explain in the commit message why this particular bit of splice
support needs compiling out when most other bits do not.
Also, a couple of style comments below.
> Signed-off-by: Pieter Smith <pieter@boesman.nl>
> ---
> include/linux/skbuff.h | 9 +++++++++
> net/core/skbuff.c | 9 ++++++---
> 2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index a59d934..8c28524 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -2640,9 +2640,18 @@ int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len);
> int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len);
> __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, u8 *to,
> int len, __wsum csum);
> +#ifdef CONFIG_SYSCALL_SPLICE
> int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
> struct pipe_inode_info *pipe, unsigned int len,
> unsigned int flags);
> +#else /* #ifdef CONFIG_SYSCALL_SPLICE */
> +static inline int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
> + struct pipe_inode_info *pipe, unsigned int len,
> + unsigned int flags)
> +{
> + return -EPERM;
> +}
> +#endif /* #ifdef CONFIG_SYSCALL_SPLICE */
These comments, and the one added below in the corresponding .c file,
don't match the prevailing style. These are so short (fitting on one
screen) that they hardly seem worth the comments at all, but if you want
to include them, s/#ifdef// in the comment.
> void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
> unsigned int skb_zerocopy_headlen(const struct sk_buff *from);
> int skb_zerocopy(struct sk_buff *to, struct sk_buff *from,
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 61059a0..74fad8a 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -1781,9 +1781,9 @@ static bool __splice_segment(struct page *page, unsigned int poff,
> * Map linear and fragment data from the skb to spd. It reports true if the
> * pipe is full or if we already spliced the requested length.
> */
> -static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
> - unsigned int *offset, unsigned int *len,
> - struct splice_pipe_desc *spd, struct sock *sk)
> +static bool __maybe_unused __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
> + unsigned int *offset, unsigned int *len,
> + struct splice_pipe_desc *spd, struct sock *sk)
> {
> int seg;
>
> @@ -1821,6 +1821,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
> * the frag list, if such a thing exists. We'd probably need to recurse to
> * handle that cleanly.
> */
> +#ifdef CONFIG_SYSCALL_SPLICE
> int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
> struct pipe_inode_info *pipe, unsigned int tlen,
> unsigned int flags)
> @@ -1876,6 +1877,8 @@ done:
>
> return ret;
> }
> +#endif /* #ifdef CONFIG_SYSCALL_SPLICE */
> +
This extra blank line shouldn't be here.
> /**
> * skb_store_bits - store bits from kernel buffer to skb
> --
> 1.9.1
>
next prev parent reply other threads:[~2014-11-22 21:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1416690001-20817-1-git-send-email-pieter@boesman.nl>
2014-11-22 21:00 ` [PATCH 5/6] net/core: support compiling out splice Pieter Smith
2014-11-22 21:48 ` Josh Triplett [this message]
[not found] ` <CAPho-_+GV+2sVVxGsPSjvE3heEoGa4chbqrmnxLAr_p7RU=TDQ@mail.gmail.com>
2014-11-22 23:07 ` Josh Triplett
2014-11-23 14:20 [PATCH 0/6] kernel tinification: optionally compile out splice family of syscalls (splice, vmsplice, tee and sendfile) Pieter Smith
[not found] ` <1416752468-1626-1-git-send-email-pieter-qeJ+1H9vRZbz+pZb47iToQ@public.gmane.org>
2014-11-23 14:20 ` [PATCH 5/6] net/core: support compiling out splice Pieter Smith
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=20141122214853.GB23711@thin \
--to=josh@joshtriplett.org \
--cc=JBeulich@suse.com \
--cc=Paul.Durrant@citrix.com \
--cc=alexander.h.duyck@intel.com \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=mszeredi@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=pieter@boesman.nl \
--cc=tgraf@suug.ch \
--cc=therbert@google.com \
--cc=willemb@google.com \
/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).