patch-2.1.46 linux/fs/file_table.c
Next file: linux/fs/inode.c
Previous file: linux/fs/ext2/ialloc.c
Back to the patch index
Back to the overall index
- Lines: 25
- Date:
Sat Jul 19 11:29:59 1997
- Orig file:
v2.1.45/linux/fs/file_table.c
- Orig date:
Thu Jul 17 10:06:07 1997
diff -u --recursive --new-file v2.1.45/linux/fs/file_table.c linux/fs/file_table.c
@@ -102,6 +102,24 @@
return f;
}
+/*
+ * Clear and initialize a (private) struct file for the given dentry,
+ * and call the open function (if any). The caller must verify that
+ * inode->i_op and inode->i_op->default_file_ops are not NULL.
+ */
+int init_private_file(struct file *filp, struct dentry *dentry, int mode)
+{
+ memset(filp, 0, sizeof(*filp));
+ filp->f_mode = mode;
+ filp->f_count = 1;
+ filp->f_dentry = dentry;
+ filp->f_op = dentry->d_inode->i_op->default_file_ops;
+ if (filp->f_op->open)
+ return filp->f_op->open(dentry->d_inode, filp);
+ else
+ return 0;
+}
+
#ifdef CONFIG_QUOTA
void add_dquot_ref(kdev_t dev, short type)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov