X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzpl_file.c;h=d76e62d4326a16257e88d9e78034bf2dc24bebad;hb=17c37660a14cc5e26cc668fdb285933fee4b6cf4;hp=585f971e8dc23abe2dea38d23077cc51d9234798;hpb=c0d35759c5ab1abaa6b72062cc4ecd0d86628de8;p=zfs.git diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c index 585f971..d76e62d 100644 --- a/module/zfs/zpl_file.c +++ b/module/zfs/zpl_file.c @@ -30,6 +30,37 @@ 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; @@ -45,8 +76,7 @@ zpl_readdir(struct file *filp, void *dirent, filldir_t filldir) 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; @@ -317,7 +347,8 @@ const struct address_space_operations zpl_address_space_operations = { }; 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,