From patchwork Fri Mar 13 01:40:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Triplett X-Patchwork-Id: 6001081 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B455ABF90F for ; Fri, 13 Mar 2015 01:42:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E10D020351 for ; Fri, 13 Mar 2015 01:42:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13E0E2034F for ; Fri, 13 Mar 2015 01:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755221AbbCMBlI (ORCPT ); Thu, 12 Mar 2015 21:41:08 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:43743 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754955AbbCMBlE (ORCPT ); Thu, 12 Mar 2015 21:41:04 -0400 Received: from mfilter15-d.gandi.net (mfilter15-d.gandi.net [217.70.178.143]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id DE1A441C061; Fri, 13 Mar 2015 02:41:02 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter15-d.gandi.net Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by mfilter15-d.gandi.net (mfilter15-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id Maty0k3ABPY8; Fri, 13 Mar 2015 02:41:01 +0100 (CET) X-Originating-IP: 50.43.43.179 Received: from jtriplet-mobl1 (static-50-43-43-179.bvtn.or.frontiernet.net [50.43.43.179]) (Authenticated sender: josh@joshtriplett.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 7323141C04B; Fri, 13 Mar 2015 02:40:56 +0100 (CET) Date: Thu, 12 Mar 2015 18:40:54 -0700 From: Josh Triplett To: Al Viro , Andrew Morton , Andy Lutomirski , Ingo Molnar , Kees Cook , Oleg Nesterov , "Paul E. McKenney" , "H. Peter Anvin" , Rik van Riel , Thomas Gleixner , Thiago Macieira , Michael Kerrisk , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, x86@kernel.org Subject: [PATCH 5/6] fs: Make alloc_fd non-private Message-ID: <5083dceeba618b421c25042c6343080f09f919f8.1426180120.git.josh@joshtriplett.org> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 This allows callers to allocate a file descriptor with a defined minimum value, without directly calling the lower-level __alloc_fd. Signed-off-by: Josh Triplett Signed-off-by: Thiago Macieira --- fs/file.c | 2 +- include/linux/file.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/file.c b/fs/file.c index ee738ea..583ba46 100644 --- a/fs/file.c +++ b/fs/file.c @@ -500,7 +500,7 @@ out: return error; } -static int alloc_fd(unsigned start, unsigned flags) +int alloc_fd(unsigned start, unsigned flags) { return __alloc_fd(current->files, start, rlimit(RLIMIT_NOFILE), flags); } diff --git a/include/linux/file.h b/include/linux/file.h index f87d308..d49f3bd 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -65,6 +65,7 @@ extern int replace_fd(unsigned fd, struct file *file, unsigned flags); extern void set_close_on_exec(unsigned int fd, int flag); extern bool get_close_on_exec(unsigned int fd); extern void put_filp(struct file *); +extern int alloc_fd(unsigned start, unsigned flags); extern int get_unused_fd_flags(unsigned flags); extern void put_unused_fd(unsigned int fd);