[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1425936003-24544-6-git-send-email-zenczykowski@gmail.com>
Date: Mon, 9 Mar 2015 14:20:01 -0700
From: Maciej Żenczykowski <zenczykowski@...il.com>
To: Maciej Żenczykowski <maze@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>
Cc: Theodore Ts'o <tytso@....edu>, netdev@...r.kernel.org
Subject: [PATCH 6/8] fs/file: add get_unused_fd_and_install_flags(flags, newfile) api
From: Maciej Żenczykowski <maze@...gle.com>
Signed-off-by: Maciej Żenczykowski <maze@...gle.com>
---
fs/file.c | 7 +++++++
include/linux/file.h | 2 ++
2 files changed, 9 insertions(+)
diff --git a/fs/file.c b/fs/file.c
index 01b1e171ce0a..d3e692e99ec5 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -513,6 +513,13 @@ int get_unused_fd_flags(unsigned flags)
}
EXPORT_SYMBOL(get_unused_fd_flags);
+int get_unused_fd_and_install_flags(unsigned flags, struct file *newfile)
+{
+ return __alloc_fd(current->files, 0, rlimit(RLIMIT_NOFILE), flags,
+ newfile);
+}
+EXPORT_SYMBOL(get_unused_fd_and_install_flags);
+
static void __put_unused_fd(struct files_struct *files, unsigned int fd)
{
struct fdtable *fdt = files_fdtable(files);
diff --git a/include/linux/file.h b/include/linux/file.h
index f87d30882a24..92b43187aa39 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -66,6 +66,8 @@ 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 get_unused_fd_flags(unsigned flags);
+extern int get_unused_fd_and_install_flags(unsigned flags,
+ struct file *newfile);
extern void put_unused_fd(unsigned int fd);
extern void fd_install(unsigned int fd, struct file *file);
--
2.2.0.rc0.207.ga3a616c
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists