diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 23:25:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 23:25:04 -0400 |
commit | aab174f0df5d72d31caccf281af5f614fa254578 (patch) | |
tree | 2a172c5009c4ac8755e858593154c258ce7709a0 /include/linux/fdtable.h | |
parent | ca41cc96b2813221b05af57d0355157924de5a07 (diff) | |
parent | 2bd2c1941f141ad780135ccc1cd08ca71a24f10a (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs update from Al Viro:
- big one - consolidation of descriptor-related logics; almost all of
that is moved to fs/file.c
(BTW, I'm seriously tempted to rename the result to fd.c. As it is,
we have a situation when file_table.c is about handling of struct
file and file.c is about handling of descriptor tables; the reasons
are historical - file_table.c used to be about a static array of
struct file we used to have way back).
A lot of stray ends got cleaned up and converted to saner primitives,
disgusting mess in android/binder.c is still disgusting, but at least
doesn't poke so much in descriptor table guts anymore. A bunch of
relatively minor races got fixed in process, plus an ext4 struct file
leak.
- related thing - fget_light() partially unuglified; see fdget() in
there (and yes, it generates the code as good as we used to have).
- also related - bits of Cyrill's procfs stuff that got entangled into
that work; _not_ all of it, just the initial move to fs/proc/fd.c and
switch of fdinfo to seq_file.
- Alex's fs/coredump.c spiltoff - the same story, had been easier to
take that commit than mess with conflicts. The rest is a separate
pile, this was just a mechanical code movement.
- a few misc patches all over the place. Not all for this cycle,
there'll be more (and quite a few currently sit in akpm's tree)."
Fix up trivial conflicts in the android binder driver, and some fairly
simple conflicts due to two different changes to the sock_alloc_file()
interface ("take descriptor handling from sock_alloc_file() to callers"
vs "net: Providing protocol type via system.sockprotoname xattr of
/proc/PID/fd entries" adding a dentry name to the socket)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (72 commits)
MAX_LFS_FILESIZE should be a loff_t
compat: fs: Generic compat_sys_sendfile implementation
fs: push rcu_barrier() from deactivate_locked_super() to filesystems
btrfs: reada_extent doesn't need kref for refcount
coredump: move core dump functionality into its own file
coredump: prevent double-free on an error path in core dumper
usb/gadget: fix misannotations
fcntl: fix misannotations
ceph: don't abuse d_delete() on failure exits
hypfs: ->d_parent is never NULL or negative
vfs: delete surplus inode NULL check
switch simple cases of fget_light to fdget
new helpers: fdget()/fdput()
switch o2hb_region_dev_write() to fget_light()
proc_map_files_readdir(): don't bother with grabbing files
make get_file() return its argument
vhost_set_vring(): turn pollstart/pollstop into bool
switch prctl_set_mm_exe_file() to fget_light()
switch xfs_find_handle() to fget_light()
switch xfs_swapext() to fget_light()
...
Diffstat (limited to 'include/linux/fdtable.h')
-rw-r--r-- | include/linux/fdtable.h | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index 158a41eed314..45052aa814c8 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h | |||
@@ -30,31 +30,11 @@ struct fdtable { | |||
30 | struct fdtable *next; | 30 | struct fdtable *next; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | static inline void __set_close_on_exec(int fd, struct fdtable *fdt) | ||
34 | { | ||
35 | __set_bit(fd, fdt->close_on_exec); | ||
36 | } | ||
37 | |||
38 | static inline void __clear_close_on_exec(int fd, struct fdtable *fdt) | ||
39 | { | ||
40 | __clear_bit(fd, fdt->close_on_exec); | ||
41 | } | ||
42 | |||
43 | static inline bool close_on_exec(int fd, const struct fdtable *fdt) | 33 | static inline bool close_on_exec(int fd, const struct fdtable *fdt) |
44 | { | 34 | { |
45 | return test_bit(fd, fdt->close_on_exec); | 35 | return test_bit(fd, fdt->close_on_exec); |
46 | } | 36 | } |
47 | 37 | ||
48 | static inline void __set_open_fd(int fd, struct fdtable *fdt) | ||
49 | { | ||
50 | __set_bit(fd, fdt->open_fds); | ||
51 | } | ||
52 | |||
53 | static inline void __clear_open_fd(int fd, struct fdtable *fdt) | ||
54 | { | ||
55 | __clear_bit(fd, fdt->open_fds); | ||
56 | } | ||
57 | |||
58 | static inline bool fd_is_open(int fd, const struct fdtable *fdt) | 38 | static inline bool fd_is_open(int fd, const struct fdtable *fdt) |
59 | { | 39 | { |
60 | return test_bit(fd, fdt->open_fds); | 40 | return test_bit(fd, fdt->open_fds); |
@@ -93,15 +73,8 @@ struct file_operations; | |||
93 | struct vfsmount; | 73 | struct vfsmount; |
94 | struct dentry; | 74 | struct dentry; |
95 | 75 | ||
96 | extern int expand_files(struct files_struct *, int nr); | ||
97 | extern void free_fdtable_rcu(struct rcu_head *rcu); | ||
98 | extern void __init files_defer_init(void); | 76 | extern void __init files_defer_init(void); |
99 | 77 | ||
100 | static inline void free_fdtable(struct fdtable *fdt) | ||
101 | { | ||
102 | call_rcu(&fdt->rcu, free_fdtable_rcu); | ||
103 | } | ||
104 | |||
105 | static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) | 78 | static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) |
106 | { | 79 | { |
107 | struct file * file = NULL; | 80 | struct file * file = NULL; |
@@ -122,8 +95,20 @@ struct task_struct; | |||
122 | struct files_struct *get_files_struct(struct task_struct *); | 95 | struct files_struct *get_files_struct(struct task_struct *); |
123 | void put_files_struct(struct files_struct *fs); | 96 | void put_files_struct(struct files_struct *fs); |
124 | void reset_files_struct(struct files_struct *); | 97 | void reset_files_struct(struct files_struct *); |
98 | void daemonize_descriptors(void); | ||
125 | int unshare_files(struct files_struct **); | 99 | int unshare_files(struct files_struct **); |
126 | struct files_struct *dup_fd(struct files_struct *, int *); | 100 | struct files_struct *dup_fd(struct files_struct *, int *); |
101 | void do_close_on_exec(struct files_struct *); | ||
102 | int iterate_fd(struct files_struct *, unsigned, | ||
103 | int (*)(const void *, struct file *, unsigned), | ||
104 | const void *); | ||
105 | |||
106 | extern int __alloc_fd(struct files_struct *files, | ||
107 | unsigned start, unsigned end, unsigned flags); | ||
108 | extern void __fd_install(struct files_struct *files, | ||
109 | unsigned int fd, struct file *file); | ||
110 | extern int __close_fd(struct files_struct *files, | ||
111 | unsigned int fd); | ||
127 | 112 | ||
128 | extern struct kmem_cache *files_cachep; | 113 | extern struct kmem_cache *files_cachep; |
129 | 114 | ||