vp->v_type = 0;
}
- return (vp);
+ return vp;
} /* vn_alloc() */
EXPORT_SYMBOL(vn_alloc);
{
struct file *fp;
struct kstat stat;
- int rc, saved_umask, flags_rw;
+ int rc, saved_umask;
vnode_t *vp;
+ BUG_ON(!(flags & (FWRITE | FREAD)));
BUG_ON(seg != UIO_SYSSPACE);
BUG_ON(!vpp);
*vpp = NULL;
if (!(flags & FCREAT) && (flags & FWRITE))
flags |= FEXCL;
- flags_rw = flags & (FWRITE | FREAD);
- flags &= ~(FWRITE | FREAD);
- switch (flags_rw) {
- case FWRITE: flags |= O_WRONLY;
- case FREAD: flags |= O_RDONLY;
- case (FWRITE | FREAD): flags |= O_RDWR;
- }
+ /* Note for filp_open() the two low bits must be remapped to mean:
+ * 01 - read-only -> 00 read-only
+ * 10 - write-only -> 01 write-only
+ * 11 - read-write -> 10 read-write
+ */
+ flags--;
if (flags & FCREAT)
saved_umask = xchg(¤t->fs->umask, 0);
(void)xchg(¤t->fs->umask, saved_umask);
if (IS_ERR(fp))
- return PTR_ERR(fp);
+ return -PTR_ERR(fp);
rc = vfs_getattr(fp->f_vfsmnt, fp->f_dentry, &stat);
if (rc) {
filp_close(fp, 0);
- return rc;
+ return -rc;
}
vp = vn_alloc(KM_SLEEP);
if (!vp) {
filp_close(fp, 0);
- return -ENOMEM;
+ return ENOMEM;
}
mutex_enter(&vp->v_lock);
realpath = kmalloc(strlen(path) + 2, GFP_KERNEL);
if (!realpath)
- return -ENOMEM;
+ return ENOMEM;
sprintf(realpath, "/%s", path);
rc = vn_open(realpath, seg, flags, mode, vpp, x1, x2);
set_fs(saved_fs);
if (rc < 0)
- return rc;
+ return -rc;
if (residp) {
*residp = len - rc;
} else {
if (rc != len)
- return -EIO;
+ return EIO;
}
return 0;
rc = filp_close(vp->v_file, 0);
vn_free(vp);
- return rc;
+ return -rc;
} /* vn_close() */
EXPORT_SYMBOL(vn_close);
exit1:
path_release(&nd);
exit:
- return rc;
+ return -rc;
slashes:
rc = !dentry->d_inode ? -ENOENT :
exit1:
path_release(&oldnd);
exit:
- return rc;
+ return -rc;
}
EXPORT_SYMBOL(vn_rename);
rc = vfs_getattr(fp->f_vfsmnt, fp->f_dentry, &stat);
if (rc)
- return rc;
+ return -rc;
vap->va_type = vn_get_sol_type(stat.mode);
vap->va_mode = stat.mode;
vap->va_rdev = stat.rdev;
vap->va_blocks = stat.blocks;
- return rc;
+ return 0;
}
EXPORT_SYMBOL(vn_getattr);
if (flags & FDSYNC)
datasync = 1;
- return file_fsync(vp->v_file, vp->v_file->f_dentry, datasync);
+ return -file_fsync(vp->v_file, vp->v_file->f_dentry, datasync);
} /* vn_fsync() */
EXPORT_SYMBOL(vn_fsync);
int rc;
if ((rc = vn_open(SPLAT_VNODE_TEST_FILE_RW, UIO_SYSSPACE,
- FWRITE | FREAD | FCREAT | FEXCL, 0644, &vp, 0, 0))) {
+ FWRITE | FCREAT | FEXCL, 0644, &vp, 0, 0))) {
splat_vprint(file, SPLAT_VNODE_TEST6_NAME,
"Failed to vn_open test file: %s (%d)\n",
SPLAT_VNODE_TEST_FILE_RW, rc);