linux/fs/autofs4
David Howells 1dce27c5aa Wrap accesses to the fd_sets in struct fdtable
Wrap accesses to the fd_sets in struct fdtable (for recording open files and
close-on-exec flags) so that we can move away from using fd_sets since we
abuse the fd_set structs by not allocating the full-sized structure under
normal circumstances and by non-core code looking at the internals of the
fd_sets.

The first abuse means that use of FD_ZERO() on these fd_sets is not permitted,
since that cannot be told about their abnormal lengths.

This introduces six wrapper functions for setting, clearing and testing
close-on-exec flags and fd-is-open flags:

	void __set_close_on_exec(int fd, struct fdtable *fdt);
	void __clear_close_on_exec(int fd, struct fdtable *fdt);
	bool close_on_exec(int fd, const struct fdtable *fdt);
	void __set_open_fd(int fd, struct fdtable *fdt);
	void __clear_open_fd(int fd, struct fdtable *fdt);
	bool fd_is_open(int fd, const struct fdtable *fdt);

Note that I've prepended '__' to the names of the set/clear functions because
they require the caller to hold a lock to use them.

Note also that I haven't added wrappers for looking behind the scenes at the
the array.  Possibly that should exist too.

Signed-off-by: David Howells <dhowells@redhat.com>
Link: http://lkml.kernel.org/r/20120216174942.23314.1364.stgit@warthog.procyon.org.uk
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
2012-02-19 10:30:52 -08:00
..
Kconfig fs/Kconfig: move autofs, autofs4 out 2009-01-22 13:15:54 +03:00
Makefile autofs4: add miscellaneous device for ioctls 2008-10-16 11:21:39 -07:00
autofs_i.h autofs4: deal with autofs4_write/autofs4_write races 2012-01-11 00:20:12 -05:00
dev-ioctl.c Wrap accesses to the fd_sets in struct fdtable 2012-02-19 10:30:52 -08:00
expire.c autofs4 - remove autofs4_lock 2011-03-24 14:54:35 -04:00
init.c convert get_sb_nodev() users 2010-10-29 04:16:31 -04:00
inode.c autofs4: deal with autofs4_write/autofs4_write races 2012-01-11 00:20:12 -05:00
root.c switch vfs_mkdir() and ->mkdir() to umode_t 2012-01-03 22:54:53 -05:00
symlink.c autofs4: keep symlink body in inode->i_private 2011-01-18 01:21:27 -05:00
waitq.c autofs4 - fix deal with autofs4_write races 2012-01-13 08:30:49 -08:00