summaryrefslogtreecommitdiffstats
path: root/include/linux/file.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-01-07 02:33:00 +0000
committer <ralf@linux-mips.org>1997-01-07 02:33:00 +0000
commitbeb116954b9b7f3bb56412b2494b562f02b864b1 (patch)
tree120e997879884e1b9d93b265221b939d2ef1ade1 /include/linux/file.h
parent908d4681a1dc3792ecafbe64265783a86c4cccb6 (diff)
Import of Linux/MIPS 2.1.14
Diffstat (limited to 'include/linux/file.h')
-rw-r--r--include/linux/file.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/file.h b/include/linux/file.h
new file mode 100644
index 000000000..a3297909d
--- /dev/null
+++ b/include/linux/file.h
@@ -0,0 +1,25 @@
+#ifndef __LINUX_FILE_H
+#define __LINUX_FILE_H
+
+extern inline struct file * fget(unsigned long fd)
+{
+ struct file * file = NULL;
+ if (fd < NR_OPEN) {
+ file = current->files->fd[fd];
+ if (file)
+ file->f_count++;
+ }
+ return file;
+}
+
+extern void __fput(struct file *, struct inode *);
+
+extern inline void fput(struct file *file, struct inode *inode)
+{
+ int count = file->f_count-1;
+ if (!count)
+ __fput(file, inode);
+ file->f_count = count;
+}
+
+#endif