diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-07-23 14:05:01 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-07-23 14:05:01 +0000 |
commit | f3627cbe9236a062012c836f3b6ee311b43f63f2 (patch) | |
tree | ae854838b9a73b35bd0f3b8f42e5fb7f9cb1d5a9 /fs/file_table.c | |
parent | fea12a7b3f20bc135ab533491411e9ff753c01c8 (diff) |
Merge with Linux 2.4.0-test5-pre4.
Diffstat (limited to 'fs/file_table.c')
-rw-r--r-- | fs/file_table.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/fs/file_table.c b/fs/file_table.c index 2eaceae07..f50058828 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -136,7 +136,7 @@ static void __fput(struct file *filp) mntput(mnt); } -void _fput(struct file *file) +static void _fput(struct file *file) { locks_remove_flock(file); __fput(file); @@ -148,6 +148,25 @@ void _fput(struct file *file) file_list_unlock(); } +void fput(struct file * file) +{ + if (atomic_dec_and_test(&file->f_count)) + _fput(file); +} + +struct file * fget(unsigned int fd) +{ + struct file * file = NULL; + struct files_struct *files = current->files; + + read_lock(&files->file_lock); + file = fcheck(fd); + if (file) + get_file(file); + read_unlock(&files->file_lock); + return file; +} + /* Here. put_filp() is SMP-safe now. */ void put_filp(struct file *file) |