aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/file.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/file.h')
-rw-r--r--include/linux/file.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/include/linux/file.h b/include/linux/file.h
index 74183e6f7f45..a59001e9ea58 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -26,19 +26,12 @@ struct embedded_fd_set {
26 unsigned long fds_bits[1]; 26 unsigned long fds_bits[1];
27}; 27};
28 28
29/*
30 * More than this number of fds: we use a separately allocated fd_set
31 */
32#define EMBEDDED_FD_SET_SIZE (BITS_PER_BYTE * sizeof(struct embedded_fd_set))
33
34struct fdtable { 29struct fdtable {
35 unsigned int max_fds; 30 unsigned int max_fds;
36 int max_fdset;
37 struct file ** fd; /* current fd array */ 31 struct file ** fd; /* current fd array */
38 fd_set *close_on_exec; 32 fd_set *close_on_exec;
39 fd_set *open_fds; 33 fd_set *open_fds;
40 struct rcu_head rcu; 34 struct rcu_head rcu;
41 struct files_struct *free_files;
42 struct fdtable *next; 35 struct fdtable *next;
43}; 36};
44 37
@@ -64,6 +57,8 @@ struct files_struct {
64 57
65#define files_fdtable(files) (rcu_dereference((files)->fdt)) 58#define files_fdtable(files) (rcu_dereference((files)->fdt))
66 59
60extern struct kmem_cache *filp_cachep;
61
67extern void FASTCALL(__fput(struct file *)); 62extern void FASTCALL(__fput(struct file *));
68extern void FASTCALL(fput(struct file *)); 63extern void FASTCALL(fput(struct file *));
69 64
@@ -81,16 +76,15 @@ extern int get_unused_fd(void);
81extern void FASTCALL(put_unused_fd(unsigned int fd)); 76extern void FASTCALL(put_unused_fd(unsigned int fd));
82struct kmem_cache; 77struct kmem_cache;
83 78
84extern struct file ** alloc_fd_array(int);
85extern void free_fd_array(struct file **, int);
86
87extern fd_set *alloc_fdset(int);
88extern void free_fdset(fd_set *, int);
89
90extern int expand_files(struct files_struct *, int nr); 79extern int expand_files(struct files_struct *, int nr);
91extern void free_fdtable(struct fdtable *fdt); 80extern void free_fdtable_rcu(struct rcu_head *rcu);
92extern void __init files_defer_init(void); 81extern void __init files_defer_init(void);
93 82
83static inline void free_fdtable(struct fdtable *fdt)
84{
85 call_rcu(&fdt->rcu, free_fdtable_rcu);
86}
87
94static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) 88static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd)
95{ 89{
96 struct file * file = NULL; 90 struct file * file = NULL;
@@ -114,4 +108,6 @@ struct files_struct *get_files_struct(struct task_struct *);
114void FASTCALL(put_files_struct(struct files_struct *fs)); 108void FASTCALL(put_files_struct(struct files_struct *fs));
115void reset_files_struct(struct task_struct *, struct files_struct *); 109void reset_files_struct(struct task_struct *, struct files_struct *);
116 110
111extern struct kmem_cache *files_cachep;
112
117#endif /* __LINUX_FILE_H */ 113#endif /* __LINUX_FILE_H */