patch-2.0.14 linux/include/linux/file.h
Next file: linux/include/linux/igmp.h
Previous file: linux/include/asm-alpha/statfs.h
Back to the patch index
Back to the overall index
- Lines: 26
- Date:
Tue Aug 20 12:14:31 1996
- Orig file:
v2.0.13/linux/include/linux/file.h
- Orig date:
Thu Jan 1 02:00:00 1970
diff -u --recursive --new-file v2.0.13/linux/include/linux/file.h linux/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
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov