patch-2.1.37 linux/include/linux/file.h
Next file: linux/include/linux/fs.h
Previous file: linux/include/linux/fb.h
Back to the patch index
Back to the overall index
- Lines: 40
- Date:
Mon May 12 10:35:43 1997
- Orig file:
v2.1.36/linux/include/linux/file.h
- Orig date:
Fri Apr 4 08:52:25 1997
diff -u --recursive --new-file v2.1.36/linux/include/linux/file.h linux/include/linux/file.h
@@ -13,16 +13,37 @@
}
extern int __fput(struct file *, struct inode *);
+extern void insert_file_free(struct file *file);
+
+/* It does not matter which list it is on. */
+extern inline void remove_filp(struct file *file)
+{
+ if(file->f_next)
+ file->f_next->f_pprev = file->f_pprev;
+ *file->f_pprev = file->f_next;
+}
extern inline int fput(struct file *file, struct inode *inode)
{
int count = file->f_count-1;
int error = 0;
- if (!count)
+ if (!count) {
error = __fput(file, inode);
- file->f_count = count;
+ file->f_count = 0;
+ remove_filp(file);
+ insert_file_free(file);
+ } else
+ file->f_count = count;
return error;
+}
+
+extern inline void put_filp(struct file *file)
+{
+ if(--file->f_count == 0) {
+ remove_filp(file);
+ insert_file_free(file);
+ }
}
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov