diff options
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 56 |
1 files changed, 0 insertions, 56 deletions
@@ -963,62 +963,6 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags) | |||
963 | } | 963 | } |
964 | EXPORT_SYMBOL(dentry_open); | 964 | EXPORT_SYMBOL(dentry_open); |
965 | 965 | ||
966 | /* | ||
967 | * Find an empty file descriptor entry, and mark it busy. | ||
968 | */ | ||
969 | int get_unused_fd_flags(int flags) | ||
970 | { | ||
971 | struct files_struct * files = current->files; | ||
972 | int fd, error; | ||
973 | struct fdtable *fdt; | ||
974 | |||
975 | spin_lock(&files->file_lock); | ||
976 | |||
977 | repeat: | ||
978 | fdt = files_fdtable(files); | ||
979 | fd = find_next_zero_bit(fdt->open_fds->fds_bits, fdt->max_fds, | ||
980 | files->next_fd); | ||
981 | |||
982 | /* Do we need to expand the fd array or fd set? */ | ||
983 | error = expand_files(files, fd); | ||
984 | if (error < 0) | ||
985 | goto out; | ||
986 | |||
987 | if (error) { | ||
988 | /* | ||
989 | * If we needed to expand the fs array we | ||
990 | * might have blocked - try again. | ||
991 | */ | ||
992 | goto repeat; | ||
993 | } | ||
994 | |||
995 | FD_SET(fd, fdt->open_fds); | ||
996 | if (flags & O_CLOEXEC) | ||
997 | FD_SET(fd, fdt->close_on_exec); | ||
998 | else | ||
999 | FD_CLR(fd, fdt->close_on_exec); | ||
1000 | files->next_fd = fd + 1; | ||
1001 | #if 1 | ||
1002 | /* Sanity check */ | ||
1003 | if (fdt->fd[fd] != NULL) { | ||
1004 | printk(KERN_WARNING "get_unused_fd: slot %d not NULL!\n", fd); | ||
1005 | fdt->fd[fd] = NULL; | ||
1006 | } | ||
1007 | #endif | ||
1008 | error = fd; | ||
1009 | |||
1010 | out: | ||
1011 | spin_unlock(&files->file_lock); | ||
1012 | return error; | ||
1013 | } | ||
1014 | |||
1015 | int get_unused_fd(void) | ||
1016 | { | ||
1017 | return get_unused_fd_flags(0); | ||
1018 | } | ||
1019 | |||
1020 | EXPORT_SYMBOL(get_unused_fd); | ||
1021 | |||
1022 | static void __put_unused_fd(struct files_struct *files, unsigned int fd) | 966 | static void __put_unused_fd(struct files_struct *files, unsigned int fd) |
1023 | { | 967 | { |
1024 | struct fdtable *fdt = files_fdtable(files); | 968 | struct fdtable *fdt = files_fdtable(files); |