From patchwork Mon Nov 24 23:01:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pieter Smith X-Patchwork-Id: 5370641 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D39069F2F5 for ; Mon, 24 Nov 2014 23:03:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2ABCD20158 for ; Mon, 24 Nov 2014 23:03:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F86120149 for ; Mon, 24 Nov 2014 23:03:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750891AbaKXXDU (ORCPT ); Mon, 24 Nov 2014 18:03:20 -0500 Received: from mail-wi0-f182.google.com ([209.85.212.182]:47249 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751065AbaKXXCn (ORCPT ); Mon, 24 Nov 2014 18:02:43 -0500 Received: by mail-wi0-f182.google.com with SMTP id h11so7519812wiw.9 for ; Mon, 24 Nov 2014 15:02:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=lk0trsp3BvCwcQbsVAso06wxkNSorKVsdarKeHBl69o=; b=bu+9TwhmQax+uNYvH0OwSUYveXV3r0itAKp993IEue+mHbXiBZnemuZb3SWYXD9BzM lzvLKDiiiogF2Amamu3RAX0XztA72bNipEUzRAMKIdK+GhHgB1UgS9akSwYvBnTDMeYi xwuwbCyGUGhBm145H1yHwYr3zHEllwnTwSEjmsIg2xp8P3PUMtuKY4clU6FNZUyodoZU FbojeJE8r2w932JhxLNsPyOcO519xY4IVbeTDHpGQmanegMRsJwPjJSqtHC023FvQhjq PiYocf5HV4S9p7Ise7i7637iqBiF0jr0RPFkjW4gt5b9MI9kXiKMcdKI6IqR5N2+Q7q3 VCSA== X-Received: by 10.180.182.226 with SMTP id eh2mr26230722wic.9.1416870161803; Mon, 24 Nov 2014 15:02:41 -0800 (PST) Received: from localhost.localdomain (ip4da2e5c1.direct-adsl.nl. [77.162.229.193]) by mx.google.com with ESMTPSA id u8sm22988325wjq.1.2014.11.24.15.02.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Nov 2014 15:02:41 -0800 (PST) From: Pieter Smith To: pieter@boesman.nl Cc: Josh Triplett , Alexander Duyck , Alexander Viro , Alexei Starovoitov , Andrew Morton , Bertrand Jacquin , Catalina Mocanu , Daniel Borkmann , "David S. Miller" , Eric Dumazet , "Eric W. Biederman" , Fabian Frederick , fuse-devel@lists.sourceforge.net (open list:FUSE: FILESYSTEM...), Geert Uytterhoeven , Hugh Dickins , Iulia Manda , Jan Beulich , "J. Bruce Fields" , Jeff Layton , linux-api@vger.kernel.org (open list:ABI/API), linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org (open list), linux-nfs@vger.kernel.org (open list:KERNEL NFSD, SUNR...), "Luis R. Rodriguez" , Matt Turner , Mel Gorman , "Michael S. Tsirkin" , Miklos Szeredi , netdev@vger.kernel.org (open list:NETWORKING [GENERAL]), Oleg Nesterov , Paul Durrant , "Paul E. McKenney" , Peter Foley , Thomas Graf , Tom Herbert , Trond Myklebust , Willem de Bruijn , Xiao Guangrong , =?UTF-8?q?=E8=94=A1=E6=AD=A3=E9=BE=99?= Subject: [PATCH v4 6/7] net/core: support compiling out splice Date: Tue, 25 Nov 2014 00:01:05 +0100 Message-Id: <1416870079-15254-7-git-send-email-pieter@boesman.nl> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1416870079-15254-1-git-send-email-pieter@boesman.nl> References: <1416870079-15254-1-git-send-email-pieter@boesman.nl> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To implement splice support, net/core makes use of nosteal_pipe_buf_ops. This struct is exported by fs/splice. The goal of the larger patch set is to completely compile out fs/splice, so uses of the exported struct need to be compiled out along with fs/splice. This patch therefore compiles out splice support in net/core when CONFIG_SYSCALL_SPLICE is undefined. The compiled out function skb_splice_bits is transparently mocked out with a static inline. The greater patch set removes userspace splice support so it cannot be called anyway. Signed-off-by: Pieter Smith --- include/linux/skbuff.h | 10 ++++++++++ net/core/skbuff.c | 11 +++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index a59d934..5cd636b 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -2640,9 +2640,19 @@ 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 +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 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..bb426d9 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -1678,7 +1678,8 @@ EXPORT_SYMBOL(skb_copy_bits); * Callback from splice_to_pipe(), if we need to release some pages * at the end of the spd in case we error'ed out in filling the pipe. */ -static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i) +static void __maybe_unused sock_spd_release(struct splice_pipe_desc *spd, + unsigned int i) { put_page(spd->pages[i]); } @@ -1781,9 +1782,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 +1822,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 +1878,7 @@ done: return ret; } +#endif /* CONFIG_SYSCALL_SPLICE */ /** * skb_store_bits - store bits from kernel buffer to skb