static int
+zpl_open(struct inode *ip, struct file *filp)
+{
+ cred_t *cr;
+ int error;
+
+ cr = (cred_t *)get_current_cred();
+ error = -zfs_open(ip, filp->f_mode, filp->f_flags, cr);
+ put_cred(cr);
+ ASSERT3S(error, <=, 0);
+
+ if (error)
+ return (error);
+
+ return generic_file_open(ip, filp);
+}
+
+static int
+zpl_release(struct inode *ip, struct file *filp)
+{
+ cred_t *cr;
+ int error;
+
+ cr = (cred_t *)get_current_cred();
+ error = -zfs_close(ip, filp->f_flags, cr);
+ put_cred(cr);
+ ASSERT3S(error, <=, 0);
+
+ return (error);
+}
+
+static int
zpl_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
struct dentry *dentry = filp->f_path.dentry;
return (error);
}
-static int
-zpl_fsync(struct file *filp, struct dentry *dentry, int datasync)
+ZPL_FSYNC_PROTO(zpl_fsync, filp, unused_dentry, datasync)
{
cred_t *cr;
int error;
};
const struct file_operations zpl_file_operations = {
- .open = generic_file_open,
+ .open = zpl_open,
+ .release = zpl_release,
.llseek = generic_file_llseek,
.read = zpl_read,
.write = zpl_write,