[PATCH 5/6] fs: Make alloc_fd non-private
From: Josh Triplett
Date: Thu Mar 12 2015 - 21:41:15 EST
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 <josh@xxxxxxxxxxxxxxxx>
Signed-off-by: Thiago Macieira <thiago.macieira@xxxxxxxxx>
---
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);
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/